Fix problems with sessions being saved as foo.ardour.ardour when loaded using the...
authorCarl Hetherington <carl@carlh.net>
Wed, 4 May 2011 11:32:35 +0000 (11:32 +0000)
committerCarl Hetherington <carl@carlh.net>
Wed, 4 May 2011 11:32:35 +0000 (11:32 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9471 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui.cc
libs/ardour/ardour/session.h
libs/ardour/session_state.cc

index 449ce2f37618d5887ca4dc2c849f9df8d419badd..79e89499b82cb0e96d1b4723083612603892cd1c 100644 (file)
@@ -2166,7 +2166,7 @@ ARDOUR_UI::save_state_canfail (string name, bool switch_to_it)
                        return ret;
                }
        }
-       cerr << "SS canfail\n";
+
        save_ardour_state (); /* XXX cannot fail? yeah, right ... */
        return 0;
 }
@@ -2503,7 +2503,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
        int ret = -1;
        bool likely_new = false;
 
-       if (! load_template.empty()) {
+       if (!load_template.empty()) {
                should_be_new = true;
                template_name = load_template;
        }
@@ -2517,14 +2517,17 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
                           to find the session.
                        */
 
-                       if (ARDOUR_COMMAND_LINE::session_name.find (statefile_suffix) != string::npos) {
+                       string::size_type suffix = ARDOUR_COMMAND_LINE::session_name.find (statefile_suffix);
+
+                       if (suffix != string::npos) {
                                session_path = Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name);
+                               session_name = ARDOUR_COMMAND_LINE::session_name.substr (0, suffix);
+                               session_name = Glib::path_get_basename (session_name);
                        } else {
                                session_path = ARDOUR_COMMAND_LINE::session_name;
+                               session_name = Glib::path_get_basename (ARDOUR_COMMAND_LINE::session_name);
                        }
 
-                       session_name = Glib::path_get_basename (ARDOUR_COMMAND_LINE::session_name);
-
                } else {
 
                        bool const apply = run_startup (should_be_new, load_template);
@@ -2680,7 +2683,9 @@ ARDOUR_UI::close_session()
        goto_editor_window ();
 }
 
-/** @return -2 if the load failed because we are not connected to the AudioEngine */
+/** @param snap_name Snapshot name (without .ardour suffix).
+ *  @return -2 if the load failed because we are not connected to the AudioEngine.
+ */
 int
 ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, std::string mix_template)
 {
index 1d37f8583a04282b40db4c79de82d1a04a383c0a..f3893eb2f2b8b2c7dfde26d9746b5274f78aad80 100644 (file)
@@ -1004,6 +1004,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void when_engine_running ();
        void graph_reordered ();
 
+       /** current snapshot name, without the .ardour suffix */
        std::string _current_snapshot_name;
 
        XMLTree*         state_tree;
index f1bebae6e3a60f986c253b40e688591d0fddf012..0c4a1a767ba64b43cc87696887baf9a60a98082b 100644 (file)
@@ -6,7 +6,7 @@
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
 
- This program is distributed in the hope that it will be useful,
 This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
@@ -755,6 +755,7 @@ Session::jack_session_event (jack_session_event_t * event)
 }
 #endif
 
+/** @param snapshot_name Name to save under, without .ardour / .pending prefix */
 int
 Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot)
 {