Change the meaning of the return value in SessionDirectory::create
authorTim Mayberry <mojofunk@gmail.com>
Sat, 23 Jun 2012 07:33:31 +0000 (07:33 +0000)
committerTim Mayberry <mojofunk@gmail.com>
Sat, 23 Jun 2012 07:33:31 +0000 (07:33 +0000)
return true if the session directories were successfully created, not
if the session directory was previously invalid(new directory).

git-svn-id: svn://localhost/ardour2/branches/3.0@12907 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/session_directory.h
libs/ardour/session_directory.cc

index 3f6d5d5e7c1d7a2546c68509f4fee62f6fabdedd..6f8f24386fabcf423d3fde3015462c89795e1d77 100644 (file)
@@ -96,8 +96,8 @@ public:
        /**
         * Create the session directory and all the subdirectories.
         *
-        * @return true If a new session directory was created, otherwise
-        * (if it already existed) false.
+        * @return true If a new session directory and subdirectories were
+        * created, otherwise false.
         *
         * @post is_valid ()
         */
index f0d928ff0efeb3e968f8b28a0471784e30cda6fc..5f3e984955de7ee82773e3fc41e00a8fa950d608 100644 (file)
@@ -50,22 +50,16 @@ SessionDirectory::operator= (const std::string& newpath)
 bool
 SessionDirectory::create ()
 {
-       bool is_new = false;
-
        vector<std::string> sub_dirs = sub_directories ();
        for (vector<std::string>::const_iterator i = sub_dirs.begin(); i != sub_dirs.end(); ++i)
        {
-               if (Glib::file_test (*i, Glib::FILE_TEST_EXISTS)) {
-                       is_new = false;
-               }
-
                if (g_mkdir_with_parents (i->c_str(), 0755) != 0) {
                        PBD::error << string_compose(_("Cannot create Session directory at path %1 Error: %2"), *i, g_strerror(errno)) << endmsg;
-
+                       return false;
                }
        }
 
-       return is_new;
+       return true;
 }
 
 bool