Always use ID in custom filenames.
authorCarl Hetherington <cth@carlh.net>
Tue, 16 Aug 2016 15:24:07 +0000 (16:24 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 16 Aug 2016 15:24:07 +0000 (16:24 +0100)
src/dcp.cc
src/dcp.h
src/name_format.cc
src/name_format.h

index 8aff6c407f512f94faa56ffaee33a69dfc3bb651..fb0f262531180931f4e508f6c6e450e6b9f653b5 100644 (file)
@@ -466,15 +466,13 @@ DCP::write_xml (
        BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) {
                NameFormat::Map values;
                values['t'] = "cpl";
-               values['i'] = i->id();
-               i->write_xml (_directory / (name_format.get(values) + ".xml"), standard, signer);
+               i->write_xml (_directory / (name_format.get(values, "_" + i->id() + ".xml")), standard, signer);
        }
 
        string const pkl_uuid = make_uuid ();
        NameFormat::Map values;
        values['t'] = "pkl";
-       values['i'] = pkl_uuid;
-       boost::filesystem::path const pkl_path = write_pkl (name_format.get(values) + ".xml", standard, pkl_uuid, metadata, signer);
+       boost::filesystem::path const pkl_path = write_pkl (name_format.get(values, "_" + pkl_uuid + ".xml"), standard, pkl_uuid, metadata, signer);
 
        write_volindex (standard);
        write_assetmap (standard, pkl_uuid, pkl_path, metadata);
index 2f297d822cf098d755dfb6309afab2ef03ec6067..e2919a38e768501bbc30e65d7033fd0eae7de3f5 100644 (file)
--- a/src/dcp.h
+++ b/src/dcp.h
@@ -113,7 +113,7 @@ public:
                Standard standard,
                XMLMetadata metadata = XMLMetadata (),
                boost::shared_ptr<const CertificateChain> signer = boost::shared_ptr<const CertificateChain> (),
-               NameFormat name_format = NameFormat("%t_%i")
+               NameFormat name_format = NameFormat("%t")
        );
 
        void resolve_refs (std::list<boost::shared_ptr<Asset> > assets);
index a85f232d17ccc9c2f6fc9975a730de9a6226573b..7b9cfd634760b1b57d6dd399729da6cdb2b9d150 100644 (file)
@@ -65,7 +65,7 @@ filter (string c)
 }
 
 string
-NameFormat::get (Map values) const
+NameFormat::get (Map values, string suffix) const
 {
        string result;
        for (size_t i = 0; i < _specification.length(); ++i) {
@@ -84,7 +84,7 @@ NameFormat::get (Map values) const
                }
        }
 
-       return result;
+       return result + suffix;
 }
 
 bool
index 7390dd5c04fe1f9d42c2fe441fafa05c90335637..eb6f430845bc4329de6493ba0e998c35bf50b772 100644 (file)
@@ -59,7 +59,7 @@ public:
 
        typedef std::map<char, std::string> Map;
 
-       std::string get (Map) const;
+       std::string get (Map, std::string suffix) const;
 
 private:
        std::string _specification;