X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_state.cc;h=07f10e9bc10236538e2207dd3532d2b9b9c9a3ef;hb=e36f74e071d4c14862d23da5ff0d49df0940d536;hp=5c3ffae3cc087c58031b3384bb5e01e2511ec89d;hpb=c0e6f8e4c324c3f44613949b59acd9e864ab263d;p=ardour.git diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 5c3ffae3cc..07f10e9bc1 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -137,7 +137,7 @@ Session::pre_engine_init (string fullpath) /* discover canonical fullpath */ _path = canonical_path(fullpath); - + /* we require _path to end with a dir separator */ if (_path[_path.length()-1] != G_DIR_SEPARATOR) { @@ -798,7 +798,7 @@ Session::load_state (string snapshot_name) set_dirty(); - _writable = exists_and_writable (xmlpath); + _writable = exists_and_writable (xmlpath) && exists_and_writable(Glib::path_get_dirname(xmlpath)); if (!state_tree->read (xmlpath)) { error << string_compose(_("Could not understand session file %1"), xmlpath) << endmsg; @@ -916,7 +916,7 @@ Session::state (bool full_state) p += (*i).path; if (next != session_dirs.end()) { - p += ':'; + p += G_SEARCHPATH_SEPARATOR; } else { break; } @@ -2680,7 +2680,7 @@ Session::cleanup_sources (CleanupReport& rep) audio_path += sdir.sound_path(); if (nexti != session_dirs.end()) { - audio_path += ':'; + audio_path += G_SEARCHPATH_SEPARATOR; } i = nexti; @@ -2698,7 +2698,7 @@ Session::cleanup_sources (CleanupReport& rep) midi_path += sdir.midi_path(); if (nexti != session_dirs.end()) { - midi_path += ':'; + midi_path += G_SEARCHPATH_SEPARATOR; } i = nexti; @@ -2736,19 +2736,23 @@ Session::cleanup_sources (CleanupReport& rep) ++tmp; if ((fs = boost::dynamic_pointer_cast (i->second)) != 0) { - if (playlists->source_use_count (fs) != 0) { - all_sources.insert (fs->path()); - } else { - /* we might not remove this source from disk, because it may be used - by other snapshots, but its not being used in this version - so lets get rid of it now, along with any representative regions - in the region list. - */ + if (!fs->is_stub()) { - RegionFactory::remove_regions_using_source (i->second); - sources.erase (i); - } + if (playlists->source_use_count (fs) != 0) { + all_sources.insert (fs->path()); + } else { + + /* we might not remove this source from disk, because it may be used + by other snapshots, but its not being used in this version + so lets get rid of it now, along with any representative regions + in the region list. + */ + + RegionFactory::remove_regions_using_source (i->second); + sources.erase (i); + } + } } i = tmp; @@ -3598,8 +3602,6 @@ Session::rename (const std::string& new_name) string const old_sources_root = _session_dir->sources_root(); -#define RENAME ::rename - /* Rename: * session directory @@ -3661,7 +3663,8 @@ Session::rename (const std::string& new_name) cerr << "Rename " << oldstr << " => " << newstr << endl; - if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) { + if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) { + error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg; return 1; } @@ -3688,7 +3691,8 @@ Session::rename (const std::string& new_name) cerr << "Rename " << oldstr << " => " << newstr << endl; - if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) { + if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) { + error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg; return 1; } } @@ -3700,7 +3704,8 @@ Session::rename (const std::string& new_name) cerr << "Rename " << oldstr << " => " << newstr << endl; - if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) { + if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) { + error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg; return 1; } @@ -3714,7 +3719,8 @@ Session::rename (const std::string& new_name) cerr << "Rename " << oldstr << " => " << newstr << endl; - if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) { + if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) { + error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg; return 1; } } @@ -3738,6 +3744,11 @@ Session::rename (const std::string& new_name) _current_snapshot_name = new_name; _name = new_name; + /* re-add directory separator - reverse hack to oldstr above */ + if (_path[_path.length()-1] != G_DIR_SEPARATOR) { + _path += G_DIR_SEPARATOR; + } + set_dirty (); /* save state again to get everything just right */ @@ -3750,8 +3761,6 @@ Session::rename (const std::string& new_name) store_recent_sessions (new_name, _path); return 0; - -#undef RENAME } int