diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-06-25 00:34:13 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-06-25 00:34:13 +0000 |
commit | 4bf64d7d8c11bf3e2c7bc1b8fbb6c754372b2739 (patch) | |
tree | ba62f96ae44bfecd32b4fea63a2d955010492c59 | |
parent | 3488b2fe094169456a4aff2f2b021a54b2db8254 (diff) |
another part of the fix for cleanup: when successfully using link(2) to embed a file in the session, make sure to store its path as a relative rather than absolute path - this way it looks like a file that actually belongs to the session
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5269 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor_audio_import.cc | 7 | ||||
-rw-r--r-- | libs/ardour/audiofilesource.cc | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index fa946f90c9..1b34d1e2a6 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -524,6 +524,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, string linked_path; SoundFileInfo finfo; int ret = 0; + Glib::ustring path_to_use; track_canvas->get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH)); gdk_flush (); @@ -537,6 +538,8 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, linked_path = session->sound_dir(); linked_path += '/'; linked_path += Glib::path_get_basename (path); + + path_to_use = path; if (link (path.c_str(), linked_path.c_str()) == 0) { @@ -547,6 +550,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, */ path = linked_path; + path_to_use = Glib::path_get_basename (linked_path); } else { @@ -558,6 +562,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, if (stat (linked_path.c_str(), &sb) == 0) { if (sb.st_nlink > 1) { // its a hard link, assume its the one we want path = linked_path; + path_to_use = Glib::path_get_basename (linked_path); } } } @@ -638,7 +643,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, if ((s = session->source_by_path_and_channel (path, n)) == 0) { source = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable - (*session, path, n, + (*session, path_to_use, n, (mode == ImportAsTapeTrack ? AudioFileSource::Destructive : AudioFileSource::Flag (0)), diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index ac5a6e7b8c..b506924513 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -154,7 +154,11 @@ AudioFileSource::init (ustring pathstr, bool must_exist) timeline_position = 0; _peaks_built = false; - if (!find (pathstr, must_exist, is_embedded(), file_is_new, _channel, _path, _name)) { + /* is_embedded() can't work yet, because our _path is not set */ + + bool embedded = determine_embeddedness (pathstr); + + if (!find (pathstr, must_exist, embedded, file_is_new, _channel, _path, _name)) { throw non_existent_source (); } @@ -568,7 +572,7 @@ AudioFileSource::find (ustring pathstr, bool must_exist, bool embedded, if (embedded) { name = pathstr; } else { - name = pathstr.substr (pathstr.find_last_of ('/') + 1); + name = Glib::path_get_basename (pathstr); } if (!Glib::file_test (pathstr, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { |