summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-09-03 17:55:11 +0200
committerCarl Hetherington <cth@carlh.net>2024-09-03 17:55:19 +0200
commit4049ec5e8bdddbc48689521a26bf47236c2b490d (patch)
tree6532546b5a1edcd77e8824d8cd854eac13e38c44 /src/lib
parent5db3eda9c6f0d6b027263c519000997677253504 (diff)
Fix a few places where we should use dcp::File::open_error()
to get a more accurate error number on Windows.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/file_group.cc2
-rw-r--r--src/lib/film.cc2
-rw-r--r--src/lib/string_text_file.cc2
-rw-r--r--src/lib/util.cc8
-rw-r--r--src/lib/writer.cc2
5 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/file_group.cc b/src/lib/file_group.cc
index 469d07702..27137196e 100644
--- a/src/lib/file_group.cc
+++ b/src/lib/file_group.cc
@@ -86,7 +86,7 @@ FileGroup::ensure_open_path (size_t p) const
auto file = dcp::File(_paths[_current_path], "rb");
if (!file) {
- throw OpenFileError(_paths[_current_path], errno, OpenFileError::READ);
+ throw OpenFileError(_paths[_current_path], file.open_error(), OpenFileError::READ);
}
_current_path = p;
diff --git a/src/lib/film.cc b/src/lib/film.cc
index d9ab6e2a3..674add78f 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -2092,7 +2092,7 @@ InfoFileHandle::InfoFileHandle (boost::mutex& mutex, boost::filesystem::path pat
, _file(path, read ? "rb" : (dcp::filesystem::exists(path) ? "r+b" : "wb"))
{
if (!_file) {
- throw OpenFileError(path, errno, read ? OpenFileError::READ : (dcp::filesystem::exists(path) ? OpenFileError::READ_WRITE : OpenFileError::WRITE));
+ throw OpenFileError(path, _file.open_error(), read ? OpenFileError::READ : (dcp::filesystem::exists(path) ? OpenFileError::READ_WRITE : OpenFileError::WRITE));
}
}
diff --git a/src/lib/string_text_file.cc b/src/lib/string_text_file.cc
index 9b43b35a6..f5d5e0d2a 100644
--- a/src/lib/string_text_file.cc
+++ b/src/lib/string_text_file.cc
@@ -57,7 +57,7 @@ StringTextFile::StringTextFile (shared_ptr<const StringTextFileContent> content)
if (ext == ".stl") {
dcp::File f(content->path(0), "rb");
if (!f) {
- throw OpenFileError (f.path(), errno, OpenFileError::READ);
+ throw OpenFileError(f.path(), f.open_error(), OpenFileError::READ);
}
try {
reader.reset(new sub::STLBinaryReader(f.get()));
diff --git a/src/lib/util.cc b/src/lib/util.cc
index f637534a9..8b767cd15 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -559,7 +559,7 @@ digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size)
while (i < int64_t (files.size()) && to_do > 0) {
dcp::File f(files[i], "rb");
if (!f) {
- throw OpenFileError (files[i].string(), errno, OpenFileError::READ);
+ throw OpenFileError(files[i].string(), f.open_error(), OpenFileError::READ);
}
auto this_time = min(to_do, dcp::filesystem::file_size(files[i]));
@@ -578,7 +578,7 @@ digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size)
while (i >= 0 && to_do > 0) {
dcp::File f(files[i], "rb");
if (!f) {
- throw OpenFileError (files[i].string(), errno, OpenFileError::READ);
+ throw OpenFileError(files[i].string(), f.open_error(), OpenFileError::READ);
}
auto this_time = min(to_do, dcp::filesystem::file_size(files[i]));
@@ -956,11 +956,11 @@ copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::fun
{
dcp::File f(from, "rb");
if (!f) {
- throw OpenFileError (from, errno, OpenFileError::READ);
+ throw OpenFileError(from, f.open_error(), OpenFileError::READ);
}
dcp::File t(to, "wb");
if (!t) {
- throw OpenFileError (to, errno, OpenFileError::WRITE);
+ throw OpenFileError(to, t.open_error(), OpenFileError::WRITE);
}
/* on the order of a second's worth of copying */
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 7b9defd73..37b8e4ccb 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -728,7 +728,7 @@ Writer::write_cover_sheet (boost::filesystem::path output_dcp)
auto const cover = film()->file("COVER_SHEET.txt");
dcp::File file(cover, "w");
if (!file) {
- throw OpenFileError (cover, errno, OpenFileError::WRITE);
+ throw OpenFileError(cover, file.open_error(), OpenFileError::WRITE);
}
auto text = Config::instance()->cover_sheet ();