Use dcp::filesystem to wrap filesystem calls and fix_long_path
[dcpomatic.git] / src / lib / zipper.cc
index d095a27bb6d74d24dd65110393086569d85330e8..e37c8aa123779f2a8da4fb0c9e5311886c00f836 100644 (file)
 */
 
 
-#include "zipper.h"
-#include "exceptions.h"
 #include "dcpomatic_assert.h"
+#include "exceptions.h"
+#include "zipper.h"
+#include <dcp/filesystem.h>
 #include <zip.h>
 #include <boost/filesystem.hpp>
 #include <stdexcept>
 
 
-using std::string;
 using std::runtime_error;
 using std::shared_ptr;
+using std::string;
 
 
 Zipper::Zipper (boost::filesystem::path file)
 {
        int error;
-       _zip = zip_open (file.string().c_str(), ZIP_CREATE | ZIP_EXCL, &error);
+       _zip = zip_open(dcp::filesystem::fix_long_path(file).string().c_str(), ZIP_CREATE | ZIP_EXCL, &error);
        if (!_zip) {
                if (error == ZIP_ER_EXISTS) {
                        throw FileError ("ZIP file already exists", file);