summaryrefslogtreecommitdiff
path: root/libs/ardour/file_source.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-03-30 14:02:26 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-03-30 14:02:26 -0400
commitb691d4bf04b46059c09e144e34fc58504926ef06 (patch)
treefca444144590883ef1b3b6b77da1c85104b51429 /libs/ardour/file_source.cc
parent864ce8f0d1aaefdbf7cb582b9ed34d669e81c468 (diff)
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
Diffstat (limited to 'libs/ardour/file_source.cc')
-rw-r--r--libs/ardour/file_source.cc11
1 files changed, 6 insertions, 5 deletions
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<int,std::string,std::string,std::vector<std::string> > 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;