Even better open-file error reports.
[dcpomatic.git] / src / lib / reel_writer.cc
index 6bc879db4b7731ec06ee94faed2d4799cdff3432..692134654a84b3301f40ec02fbae8660b19cc852 100644 (file)
@@ -128,13 +128,14 @@ ReelWriter::write_frame_info (Frame frame, Eyes eyes, dcp::FrameInfo info) const
 {
        FILE* file = 0;
        boost::filesystem::path info_file = _film->info_file (_period);
-       if (boost::filesystem::exists (info_file)) {
+       bool const read = boost::filesystem::exists (info_file);
+       if (read) {
                file = fopen_boost (info_file, "r+b");
        } else {
                file = fopen_boost (info_file, "wb");
        }
        if (!file) {
-               throw OpenFileError (info_file, errno);
+               throw OpenFileError (info_file, errno, read);
        }
        dcpomatic_fseek (file, frame_info_position (frame, eyes), SEEK_SET);
        fwrite (&info.offset, sizeof (info.offset), 1, file);