Switch to testing on Ubuntu 16.04 and 22.04.
[libdcp.git] / src / mono_picture_asset.cc
index 5aba95d26c12bd7250de5a20bf21676501d9b5a6..cc24e198a860512aa9228ce4bcfe492416581c9f 100644 (file)
  */
 
 
+#include "compose.hpp"
+#include "dcp_assert.h"
+#include "equality_options.h"
+#include "exceptions.h"
+#include "filesystem.h"
 #include "mono_picture_asset.h"
-#include "mono_picture_asset_writer.h"
 #include "mono_picture_asset_reader.h"
-#include "exceptions.h"
-#include "dcp_assert.h"
+#include "mono_picture_asset_writer.h"
 #include "mono_picture_frame.h"
-#include "compose.hpp"
 #include <asdcp/AS_DCP.h>
 #include <asdcp/KM_fileio.h>
 
@@ -65,7 +67,7 @@ MonoPictureAsset::MonoPictureAsset (boost::filesystem::path file)
        : PictureAsset (file)
 {
        ASDCP::JP2K::MXFReader reader;
-       auto r = reader.OpenRead (file.string().c_str());
+       auto r = reader.OpenRead(dcp::filesystem::fix_long_path(file).string().c_str());
        if (ASDCP_FAILURE(r)) {
                boost::throw_exception (MXFFileError("could not open MXF file for reading", file.string(), r));
        }
@@ -101,7 +103,7 @@ storing_note_handler (list<pair<NoteType, string>>& notes, NoteType t, string s)
 
 
 bool
-MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
+MonoPictureAsset::equals(shared_ptr<const Asset> other, EqualityOptions const& opt, NoteHandler note) const
 {
        if (!dynamic_pointer_cast<const MonoPictureAsset>(other)) {
                return false;
@@ -109,14 +111,14 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No
 
        ASDCP::JP2K::MXFReader reader_A;
        DCP_ASSERT (_file);
-       auto r = reader_A.OpenRead (_file->string().c_str());
+       auto r = reader_A.OpenRead(dcp::filesystem::fix_long_path(*_file).string().c_str());
        if (ASDCP_FAILURE(r)) {
                boost::throw_exception (MXFFileError("could not open MXF file for reading", _file->string(), r));
        }
 
        ASDCP::JP2K::MXFReader reader_B;
        DCP_ASSERT (other->file ());
-       r = reader_B.OpenRead (other->file()->string().c_str());
+       r = reader_B.OpenRead(dcp::filesystem::fix_long_path(*other->file()).string().c_str());
        if (ASDCP_FAILURE (r)) {
                boost::throw_exception (MXFFileError ("could not open MXF file for reading", other->file()->string(), r));
        }
@@ -183,10 +185,10 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No
 
 
 shared_ptr<PictureAssetWriter>
-MonoPictureAsset::start_write (boost::filesystem::path file, bool overwrite)
+MonoPictureAsset::start_write(boost::filesystem::path file, Behaviour behaviour)
 {
        /* Can't use make_shared here as the MonoPictureAssetWriter constructor is private */
-       return shared_ptr<MonoPictureAssetWriter>(new MonoPictureAssetWriter(this, file, overwrite));
+       return shared_ptr<MonoPictureAssetWriter>(new MonoPictureAssetWriter(this, file, behaviour == Behaviour::OVERWRITE_EXISTING));
 }
 
 shared_ptr<MonoPictureAssetReader>