Fix writing KDMs with long filenames.
authorCarl Hetherington <cth@carlh.net>
Thu, 17 Mar 2022 20:45:46 +0000 (21:45 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 2 Apr 2022 20:24:26 +0000 (22:24 +0200)
src/lib/kdm_with_metadata.cc

index 9292be224fa218ff8310988a14ebcb14dbf565ee..e3c0d9204a065aee1c3f31d202f54d6c265357f6 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "cinema.h"
 #include "config.h"
+#include "cross.h"
 #include "dcpomatic_log.h"
 #include "emailer.h"
 #include "kdm_with_metadata.h"
@@ -65,7 +66,7 @@ write_files (
 
        /* Write KDMs to the specified directory */
        for (auto i: kdms) {
-               auto out = directory / careful_string_filter(name_format.get(i->name_values(), ".xml"));
+               auto out = fix_long_path(directory / careful_string_filter(name_format.get(i->name_values(), ".xml")));
                if (!boost::filesystem::exists (out) || confirm_overwrite (out)) {
                        i->kdm_as_xml (out);
                        ++written;
@@ -145,7 +146,7 @@ write_directories (
        int written = 0;
 
        for (auto const& i: kdms) {
-               boost::filesystem::path path = directory;
+               auto path = directory;
                path /= container_name_format.get(i.front()->name_values(), "", "s");
                if (!boost::filesystem::exists (path) || confirm_overwrite (path)) {
                        boost::filesystem::create_directories (path);