diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-02 11:20:37 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-02 11:20:37 -0400 |
commit | 74bc0c84686c4a85941b98d17179d3209bf9a2a8 (patch) | |
tree | 8b14bd2694fd2c807f455d6ee3330eeb6a3d4033 /libs/ardour/smf_source.cc | |
parent | 08a1409b1f5b5558d2eccc28a3ae4cbd44391812 (diff) |
substantive changes to the logic and safety for naming of (audio/MIDI) sources, especially when created via import
Diffstat (limited to 'libs/ardour/smf_source.cc')
-rw-r--r-- | libs/ardour/smf_source.cc | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index c3bc78c83d..1cd456ee58 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -718,34 +718,3 @@ SMFSource::prevent_deletion () _flags = Flag (_flags & ~(Removable|RemovableIfEmpty|RemoveAtDestroy)); } -int -SMFSource::rename (const string& newname) -{ - Glib::Threads::Mutex::Lock lm (_lock); - string oldpath = _path; - string newpath = _session.new_source_path_from_name (DataType::MIDI, newname); - - if (newpath.empty()) { - error << string_compose (_("programming error: %1"), "cannot generate a changed file path") << endmsg; - return -1; - } - - // Test whether newpath exists, if yes notify the user but continue. - if (Glib::file_test (newpath, Glib::FILE_TEST_EXISTS)) { - error << string_compose (_("Programming error! %1 tried to rename a file over another file! It's safe to continue working, but please report this to the developers."), PROGRAM_NAME) << endmsg; - return -1; - } - - 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; - return -1; - } - } - - _name = Glib::path_get_basename (newpath); - _path = newpath; - - return 0; -} |