Don't try to rename the route template state dir if it doesn't exist
authorJohannes Mueller <github@johannes-mueller.org>
Thu, 20 Jul 2017 18:08:09 +0000 (20:08 +0200)
committerJohannes Mueller <github@johannes-mueller.org>
Thu, 20 Jul 2017 18:08:09 +0000 (20:08 +0200)
gtk2_ardour/template_dialog.cc

index 4b2813b7d5aed0d8bf16d67a31cfa1ed8f68b1d0..c437c246aac97d7df974aa0dd9ab21bd0a82c051 100644 (file)
@@ -568,9 +568,11 @@ RouteTemplateManager::rename_template (TreeModel::iterator& item, const Glib::us
        const string new_state_dir = Glib::build_filename (user_route_template_directory(), new_name);
 
        if (adjusted) {
-               if (g_rename (old_state_dir.c_str(), new_state_dir.c_str()) != 0) {
-                       error << string_compose (_("Could not rename state dir \"%1\" to \"%22\": %3"), old_state_dir, new_state_dir, strerror (errno)) << endmsg;
-                       return;
+               if (g_file_test (old_state_dir.c_str(), G_FILE_TEST_EXISTS)) {
+                       if (g_rename (old_state_dir.c_str(), new_state_dir.c_str()) != 0) {
+                               error << string_compose (_("Could not rename state dir \"%1\" to \"%22\": %3"), old_state_dir, new_state_dir, strerror (errno)) << endmsg;
+                               return;
+                       }
                }
        }