From b691d4bf04b46059c09e144e34fc58504926ef06 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 30 Mar 2013 14:02:26 -0400 Subject: fix up some confusion with filesources' _origin and _file_is_new members. if _origin is set, it means that the file is "external" to the session (aka "embedded") and for some purposes this is more significant than _file_is_new. rename SourceFactory::createReadable() to ::createExternal() to more clearly indicate its purpose; remove never-supplied "origin" argument from SourceFactor::createWritable(). Fixes problems caused by 864ce8f0 --- libs/ardour/file_source.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libs/ardour/file_source.cc') diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 8c207feea7..e3a442b0de 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) @@ -133,11 +133,12 @@ FileSource::init (const string& pathstr, bool must_exist) } 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; -- cgit v1.2.3