more error messages if session renaming fails, and remove stupid use of RENAME macro...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 12 Mar 2014 12:49:18 +0000 (08:49 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 12 Mar 2014 12:49:18 +0000 (08:49 -0400)
libs/ardour/session_state.cc

index 3e117f61d394274ed63c005ed5b8a2e56640503b..47971bf633754cf2e3a62a67a28262f7054cabc3 100644 (file)
@@ -3602,8 +3602,6 @@ Session::rename (const std::string& new_name)
 
        string const old_sources_root = _session_dir->sources_root();
 
-#define RENAME ::rename
-
        /* Rename:
 
         * session directory
@@ -3665,7 +3663,8 @@ Session::rename (const std::string& new_name)
 
                cerr << "Rename " << oldstr << " => " << newstr << endl;                
 
-               if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) {
+               if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
+                       error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
                        return 1;
                }
 
@@ -3692,7 +3691,8 @@ Session::rename (const std::string& new_name)
                
                cerr << "Rename " << oldstr << " => " << newstr << endl;
                
-               if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) {
+               if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
+                       error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
                        return 1;
                }
        }
@@ -3704,7 +3704,8 @@ Session::rename (const std::string& new_name)
        
        cerr << "Rename " << oldstr << " => " << newstr << endl;                
 
-       if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) {
+       if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
+               error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
                return 1;
        }
 
@@ -3718,7 +3719,8 @@ Session::rename (const std::string& new_name)
                
                cerr << "Rename " << oldstr << " => " << newstr << endl;                
                
-               if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) {
+               if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
+                       error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
                        return 1;
                }
        }
@@ -3754,8 +3756,6 @@ Session::rename (const std::string& new_name)
        store_recent_sessions (new_name, _path);
 
        return 0;
-
-#undef RENAME
 }
 
 int