From 5764970709f15e85ec30c9cea89c318eb8114c58 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 14 Apr 2014 03:03:35 -0400 Subject: more work on linking file existence and removability --- libs/ardour/file_source.cc | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'libs/ardour/file_source.cc') diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 709915378d..109539ce2d 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -62,8 +62,6 @@ FileSource::FileSource (Session& session, DataType type, const string& path, con , _open (false) { set_within_session_from_path (path); - - prevent_deletion (); } FileSource::FileSource (Session& session, const XMLNode& node, bool /*must_exist*/) @@ -77,8 +75,6 @@ FileSource::FileSource (Session& session, const XMLNode& node, bool /*must_exist _path = _name; _within_session = true; - - prevent_deletion (); } FileSource::~FileSource() @@ -86,20 +82,21 @@ FileSource::~FileSource() } void -FileSource::prevent_deletion () +FileSource::existence_check () { - /* if this file already exists, it cannot be removed, ever - */ - if (Glib::file_test (_path, Glib::FILE_TEST_EXISTS)) { - cerr << " ... " << _path << " already exists, marking immutable\n"; + prevent_deletion (); + } +} - if (!(_flags & Destructive)) { - mark_immutable (); - } else { - _flags = Flag (_flags & ~(Removable|RemovableIfEmpty|RemoveAtDestroy)); - } - } +void +FileSource::prevent_deletion () +{ + if (!(_flags & Destructive)) { + mark_immutable (); + } else { + _flags = Flag (_flags & ~(Removable|RemovableIfEmpty|RemoveAtDestroy)); + } } bool -- cgit v1.2.3