diff options
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/file_source.h | 2 | ||||
-rw-r--r-- | libs/ardour/file_source.cc | 19 | ||||
-rw-r--r-- | libs/ardour/sndfilesource.cc | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h index 4aadce27e8..699eec4c41 100644 --- a/libs/ardour/ardour/file_source.h +++ b/libs/ardour/ardour/file_source.h @@ -99,6 +99,8 @@ protected: uint16_t _channel; bool _within_session; std::string _origin; + + void prevent_deletion (); }; } // namespace ARDOUR diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 84d4f3043f..ae7fbdc38c 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -62,6 +62,8 @@ FileSource::FileSource (Session& session, DataType type, const string& path, con , _origin (origin) { set_within_session_from_path (path); + + prevent_deletion (); } FileSource::FileSource (Session& session, const XMLNode& node, bool /*must_exist*/) @@ -75,6 +77,23 @@ FileSource::FileSource (Session& session, const XMLNode& node, bool /*must_exist _path = _name; _within_session = true; + + prevent_deletion (); +} + +void +FileSource::prevent_deletion () +{ + /* if this file already exists, it cannot be removed, ever + */ + + if (Glib::file_test (_path, Glib::FILE_TEST_EXISTS)) { + if (!(_flags & Destructive)) { + mark_immutable (); + } else { + _flags = Flag (_flags & ~(Removable|RemovableIfEmpty|RemoveAtDestroy)); + } + } } bool diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 3c219dc191..20d6067c36 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -612,7 +612,7 @@ bool SndFileSource::set_destructive (bool yn) { if (yn) { - _flags = Flag (_flags | Destructive); + _flags = Flag (_flags | Writable | Destructive); if (!xfade_buf) { xfade_buf = new Sample[xfade_frames]; } |