Cope with paths having file:// at the start of them.
authorCarl Hetherington <cth@carlh.net>
Sun, 9 Sep 2012 15:11:02 +0000 (16:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 9 Sep 2012 15:11:02 +0000 (16:11 +0100)
src/asset_map.cc
src/util.cc
src/util.h
test/ref/info.log

index 31809c9b0a71a01d9230fc06298a6e9d65cfe5f5..35f96c45ac7216b66285bc4355ee4976ae2ee5c9 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "asset_map.h"
+#include "util.h"
 
 using namespace std;
 using namespace boost;
@@ -50,6 +51,13 @@ Chunk::Chunk (xmlpp::Node const * node)
        : XMLNode (node)
 {
        path = string_node ("Path");
+
+       string const prefix = "file://";
+
+       if (starts_with (path, prefix)) {
+               path = path.substr (prefix.length());
+       }
+       
        volume_index = optional_int64_node ("VolumeIndex");
        offset = optional_int64_node ("Offset");
        length = optional_int64_node ("Length");
index ad6a66fec30e04fa7870e05669f233b39a52258e..fd76e556b464d32520417ca5c664fc4ac0a929c7 100644 (file)
@@ -148,6 +148,16 @@ libdcp::content_kind_from_string (string type)
        assert (false);
 }
                
+bool
+libdcp::starts_with (string big, string little)
+{
+       if (little.size() > big.size()) {
+               return false;
+       }
+
+       return big.substr (0, little.length()) == little;
+}
+
 bool
 libdcp::ends_with (string big, string little)
 {
index af6a08d671b789025055e83ddb6aab03cd1768d6..9485c450f36799f9c271b07a17131ebddf85182c 100644 (file)
@@ -46,6 +46,7 @@ extern std::string make_digest (std::string filename, sigc::signal1<void, float>
 
 extern std::string content_kind_to_string (ContentKind kind);
 extern ContentKind content_kind_from_string (std::string kind);
+extern bool starts_with (std::string big, std::string little);
 extern bool ends_with (std::string big, std::string little);
 
 extern opj_image_t* decompress_j2k (uint8_t* data, int64_t size, int reduce);
index fdd6537e59b568e8be7ca584ca8a2c4fdd554fbc..2f1c6e93c96af8fee91220b47d28c8b310f798ff 100644 (file)
@@ -82,6 +82,11 @@ DCP: ../libdcp-test/MACHINE-GUN-PREACH_TLR-1_F_EN-de-fr_CH_51_2K_TIT_20111107
     Frames per second: 24
     Reel 1
       Subtitle: 94 subtitles in English
+DCP: ../libdcp-test/DU-VENT-DANS-MES-MOLLETS_TLR_F_FR-XX_FR_51_2K_GA_20120621_ECL_OV
+  CPL: DU-VENT-DANS-MES-MOLLETS_TLR_F_FR-XX_FR_51_2K_GA_20120621_ECL_OV
+    Length: 2502
+    Frames per second: 24
+    Reel 1
 DCP: ../libdcp-test/ASTERIX_TLR-01_F_FR-DE_CH_51_2K_FRE_20120730_DGL_OV
   CPL: 
     Length: 3080