diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-02-14 16:04:53 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-02-14 16:04:53 +0000 |
commit | 7ac5d03cb870acb429b7fb0c315dd5774d4e0b8c (patch) | |
tree | 149474d5a0e388df5931721f09f5ef2d153df70d /libs/ardour/file_source.cc | |
parent | b307462f4f85cb75f5aa67b3d4f66f8717fa6051 (diff) |
3.0 version of previous 2.X change to always prevent deletion of existing sources
git-svn-id: svn://localhost/ardour2/branches/3.0@8842 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/file_source.cc')
-rw-r--r-- | libs/ardour/file_source.cc | 19 |
1 files changed, 19 insertions, 0 deletions
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 |