diff --git a/gtk2_ardour/startup_fsm.cc b/gtk2_ardour/startup_fsm.cc index 70f0f0d708..b724d6c6cf 100644 --- a/gtk2_ardour/startup_fsm.cc +++ b/gtk2_ardour/startup_fsm.cc @@ -583,15 +583,6 @@ StartupFSM::get_session_parameters_from_path (string const & path_, string const string path (path_); - /* ... did the user give us a path or just a name? */ - - if (path.find (G_DIR_SEPARATOR) == string::npos) { - /* user gave session name with no path info, use - default session folder. - */ - path = Glib::build_filename (Config->get_default_session_parent_dir (), path); - } - if (Glib::file_test (path.c_str(), Glib::FILE_TEST_EXISTS)) { session_is_new = false; @@ -606,6 +597,10 @@ StartupFSM::get_session_parameters_from_path (string const & path_, string const } } + // TODO THIS SHOULD CALL ::check_session_parameters (false) + // to handle session archives etc + // (needs refactoring of ::check_session_parameters) + session_name = basename_nosuffix (path); if (Glib::file_test (path.c_str(), Glib::FILE_TEST_IS_REGULAR)) { @@ -642,6 +637,18 @@ StartupFSM::get_session_parameters_from_path (string const & path_, string const } + if (!ARDOUR_COMMAND_LINE::new_session) { + return false; + } + + /* ... did the user give us a path or just a name? */ + if (!Glib::path_is_absolute (path)) { + /* check for cwd relative path */ + if (path.find (G_DIR_SEPARATOR) == string::npos) { + path = Glib::build_filename (Config->get_default_session_parent_dir (), path); + } + } + /* Everything after this involves a new session */ session_name = basename_nosuffix (path); @@ -810,25 +817,11 @@ StartupFSM::check_session_parameters (bool must_be_new) session_template = session_dialog->session_template_name(); } - if (session_name[0] == G_DIR_SEPARATOR || -#ifdef PLATFORM_WINDOWS - // Windows file system .. detect absolute path - // C:/* - (session_name.length() > 3 && session_name[1] == ':' && session_name[2] == G_DIR_SEPARATOR) -#else - // Sensible file systems - // /* or ./* or ../* - (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == G_DIR_SEPARATOR) || - (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == G_DIR_SEPARATOR) -#endif - ) - { - + if (Glib::path_is_absolute (session_name) || session_name.find (G_DIR_SEPARATOR) != string::npos) { /* user typed absolute path or cwd-relative path - specified into session name field. So ... infer - session path and name from what was given. - */ - + * specified into session name field. So ... infer + * session path and name from what was given. + */ session_path = Glib::path_get_dirname (session_name); session_name = Glib::path_get_basename (session_name);