X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Ffile_source.cc;h=c148c6dd82e8fa87b707e52dede1ea3183e8dd14;hb=d5cc04d57bf06741dbb633ce0c6c5d004d7038a0;hp=0aec49e6bdd74899dbfafa28d903d0aa6047fc75;hpb=050d46a33e80be0e9ac88788a7f6a06442fb7c55;p=ardour.git diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 0aec49e6bd..c148c6dd82 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -58,7 +58,7 @@ FileSource::FileSource (Session& session, DataType type, const string& path, con , _path (path) , _file_is_new (!origin.empty()) // if origin is left unspecified (empty string) then file must exist , _channel (0) - , _origin (origin) + , _origin (origin) { set_within_session_from_path (path); } @@ -140,7 +140,7 @@ FileSource::init (const string& pathstr, bool must_exist) int FileSource::set_state (const XMLNode& node, int /*version*/) { - const XMLProperty* prop; + XMLProperty const * prop; if ((prop = node.property (X_("channel"))) != 0) { _channel = atoi (prop->value()); @@ -148,9 +148,9 @@ FileSource::set_state (const XMLNode& node, int /*version*/) _channel = 0; } - if ((prop = node.property (X_("origin"))) != 0) { - _origin = prop->value(); - } + if ((prop = node.property (X_("origin"))) != 0) { + _origin = prop->value(); + } return 0; } @@ -274,7 +274,7 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist vector::iterator j = i; ++j; - + while (j != hits.end()) { if (PBD::equivalent_paths (*i, *j)) { /* *i and *j are the same file; break out of the loop early */ @@ -316,10 +316,10 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist } else { /* only one match: happy days */ - + keeppath = de_duped_hits[0]; } - + } else { keeppath = path; } @@ -337,7 +337,6 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist } found_path = keeppath; - ret = true; out: @@ -545,6 +544,7 @@ FileSource::set_within_session_from_path (const std::string& path) void FileSource::set_path (const std::string& newpath) { + close (); _path = newpath; set_within_session_from_path (newpath); if (_within_session) { @@ -566,7 +566,7 @@ FileSource::is_stub () const if (!empty()) { return false; } - + if (!removable()) { return false; } @@ -577,7 +577,7 @@ FileSource::is_stub () const return true; } - + int FileSource::rename (const string& newpath) { @@ -590,7 +590,7 @@ FileSource::rename (const string& newpath) return -1; } - if (Glib::file_test (oldpath.c_str(), Glib::FILE_TEST_EXISTS)) { + if (Glib::file_test (oldpath.c_str(), Glib::FILE_TEST_EXISTS)) { /* rename only needed if file exists on disk */ if (::rename (oldpath.c_str(), newpath.c_str()) != 0) { error << string_compose (_("cannot rename file %1 to %2 (%3)"), oldpath, newpath, strerror(errno)) << endmsg; @@ -604,4 +604,4 @@ FileSource::rename (const string& newpath) return 0; } - +