projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use C locale, because POSIX locale is not supported on windows, and operation is...
[ardour.git]
/
libs
/
ardour
/
file_source.cc
diff --git
a/libs/ardour/file_source.cc
b/libs/ardour/file_source.cc
index 8c41f981b9b480ac5da359096659f294ec313298..0aec49e6bdd74899dbfafa28d903d0aa6047fc75 100644
(file)
--- a/
libs/ardour/file_source.cc
+++ b/
libs/ardour/file_source.cc
@@
-59,7
+59,6
@@
FileSource::FileSource (Session& session, DataType type, const string& path, con
, _file_is_new (!origin.empty()) // if origin is left unspecified (empty string) then file must exist
, _channel (0)
, _origin (origin)
, _file_is_new (!origin.empty()) // if origin is left unspecified (empty string) then file must exist
, _channel (0)
, _origin (origin)
- , _open (false)
{
set_within_session_from_path (path);
}
{
set_within_session_from_path (path);
}
@@
-67,6
+66,7
@@
FileSource::FileSource (Session& session, DataType type, const string& path, con
FileSource::FileSource (Session& session, const XMLNode& node, bool /*must_exist*/)
: Source (session, node)
, _file_is_new (false)
FileSource::FileSource (Session& session, const XMLNode& node, bool /*must_exist*/)
: Source (session, node)
, _file_is_new (false)
+ , _channel (0)
{
/* this setting of _path is temporary - we expect derived classes
to call ::init() which will actually locate the file
{
/* this setting of _path is temporary - we expect derived classes
to call ::init() which will actually locate the file
@@
-252,8
+252,6
@@
FileSource::find (Session& s, DataType type, const string& path, bool must_exist
goto out;
}
goto out;
}
- hits.clear ();
-
for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
fullpath = Glib::build_filename (*i, path);
for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
fullpath = Glib::build_filename (*i, path);
@@
-308,8
+306,9
@@
FileSource::find (Session& s, DataType type, const string& path, bool must_exist
/* no match: error */
if (must_exist) {
/* no match: error */
if (must_exist) {
- error << string_compose(
- _("Filesource: cannot find required file (%1)"), path) << endmsg;
+ /* do not generate an error here, leave that to
+ whoever deals with the false return value.
+ */
goto out;
} else {
isnew = true;
goto out;
} else {
isnew = true;
@@
-320,16
+319,17
@@
FileSource::find (Session& s, DataType type, const string& path, bool must_exist
keeppath = de_duped_hits[0];
}
keeppath = de_duped_hits[0];
}
-
-
} else {
+
+ } else {
keeppath = path;
}
/* Current find() is unable to parse relative path names to yet non-existant
sources. QuickFix(tm)
*/
keeppath = path;
}
/* Current find() is unable to parse relative path names to yet non-existant
sources. QuickFix(tm)
*/
- if (keeppath == "") {
- if (must_exist) {
+
+ if (keeppath.empty()) {
+ if (must_exist) {
error << "FileSource::find(), keeppath = \"\", but the file must exist" << endl;
} else {
keeppath = path;
error << "FileSource::find(), keeppath = \"\", but the file must exist" << endl;
} else {
keeppath = path;
@@
-546,6
+546,12
@@
void
FileSource::set_path (const std::string& newpath)
{
_path = newpath;
FileSource::set_path (const std::string& newpath)
{
_path = newpath;
+ set_within_session_from_path (newpath);
+ if (_within_session) {
+ _origin = Glib::path_get_basename (newpath);
+ } else {
+ _origin = newpath;
+ }
}
void
}
void
@@
-597,3
+603,5
@@
FileSource::rename (const string& newpath)
return 0;
}
return 0;
}
+
+