From 24728b74693bb84d79474e014cdb952abc8a79f2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 16 Dec 2024 01:58:57 +0100 Subject: Give ownership of info files to ReelWriters (#2912). The motivation here is to stop a pattern where we create a file, close it, and then re-open it (many times) as I think there are problems on Windows when a virus scanner sees the new file, opens it for checking, and then we can't re-open it. This also makes things a fair bit simpler, as a lock is removed and we don't try to differentiate read/write cases by opening the file in different ways; it's now always writeable. --- src/lib/film.cc | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src/lib/film.cc') diff --git a/src/lib/film.cc b/src/lib/film.cc index 1258cdb11..1ac519011 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -2235,21 +2235,6 @@ Film::marker (dcp::Marker type) const return i->second; } -shared_ptr -Film::info_file_handle (DCPTimePeriod period, bool read) const -{ - return std::make_shared(_info_file_mutex, info_file(period), read); -} - -InfoFileHandle::InfoFileHandle (boost::mutex& mutex, boost::filesystem::path path, bool read) - : _lock (mutex) - , _file(path, read ? "rb" : (dcp::filesystem::exists(path) ? "r+b" : "wb")) -{ - if (!_file) { - throw OpenFileError(path, _file.open_error(), read ? OpenFileError::READ : (dcp::filesystem::exists(path) ? OpenFileError::READ_WRITE : OpenFileError::WRITE)); - } -} - /** Add FFOC and LFOC markers to a list if they are not already there */ void -- cgit v1.2.3