X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Ffile_source.cc;h=09214981861f142536d714b894b44adeb8e2d2a1;hb=9cb678ebcc2ca0c7993bdd182c9e6ad1f8adf09a;hp=cd39faa08ed67efad91c81042a9e87e71ee1eb1d;hpb=3cd8138a419cb165f56070ace0b21a1e63ec5a43;p=ardour.git diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index cd39faa08e..0921498186 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -55,8 +55,8 @@ PBD::Signal3 > FileSource:: FileSource::FileSource (Session& session, DataType type, const string& path, const string& origin, Source::Flag flag) : Source(session, type, path, flag) - , _path(path) - , _file_is_new(true) + , _path (path) + , _file_is_new (!origin.empty()) // origin empty => new file VS. origin !empty => new file , _channel (0) , _origin (origin) , _open (false) @@ -111,22 +111,24 @@ FileSource::init (const string& pathstr, bool must_exist) { _timeline_position = 0; - if (Stateful::loading_state_version < 3000) { - if (!find_2X (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) { - throw MissingSource (pathstr, _type); - } - } else { - if (!find (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) { - throw MissingSource (pathstr, _type); - } - } + if (Stateful::loading_state_version < 3000) { + if (!find_2X (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) { + throw MissingSource (pathstr, _type); + } + } else { + if (!find (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) { + throw MissingSource (pathstr, _type); + } + } set_within_session_from_path (_path); - + _name = Glib::path_get_basename (_path); - if (_file_is_new && must_exist) { - return -1; + if (must_exist) { + if (!Glib::file_test (_path, Glib::FILE_TEST_EXISTS)) { + throw MissingSource (pathstr, _type); + } } return 0;