Fix problems with sessions being saved as foo.ardour.ardour when loaded using the session file name (#4026).

git-svn-id: svn://localhost/ardour2/branches/3.0@9471 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-05-04 11:32:35 +00:00
parent 56b70dcc0b
commit bcb554a190
3 changed files with 14 additions and 7 deletions

View 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)
{

View 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;

View 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)
{