From cf4e4272f72346c39964b128f78b2297f04dba55 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 17 Mar 2021 11:53:28 +0100 Subject: Tidy how we're finding the tags and xsd directories. --- src/verify.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/verify.cc') diff --git a/src/verify.cc b/src/verify.cc index 97758e61..8c367563 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -1104,17 +1104,20 @@ dcp::verify ( vector directories, function)> stage, function progress, - boost::filesystem::path xsd_dtd_directory + optional xsd_dtd_directory ) { - xsd_dtd_directory = boost::filesystem::canonical (xsd_dtd_directory); + if (!xsd_dtd_directory) { + xsd_dtd_directory = resources_directory() / "xsd"; + } + *xsd_dtd_directory = boost::filesystem::canonical (*xsd_dtd_directory); vector notes; State state{}; vector> dcps; for (auto i: directories) { - dcps.push_back (shared_ptr (new DCP (i))); + dcps.push_back (make_shared(i)); } for (auto dcp: dcps) { @@ -1137,7 +1140,7 @@ dcp::verify ( for (auto cpl: dcp->cpls()) { stage ("Checking CPL", cpl->file()); - validate_xml (cpl->file().get(), xsd_dtd_directory, notes); + validate_xml (cpl->file().get(), *xsd_dtd_directory, notes); if (cpl->any_encrypted() && !cpl->all_encrypted()) { notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::PARTIALLY_ENCRYPTED}); @@ -1266,7 +1269,7 @@ dcp::verify ( if (reel->main_subtitle()) { verify_main_subtitle_reel (reel->main_subtitle(), notes); if (reel->main_subtitle()->asset_ref().resolved()) { - verify_subtitle_asset (reel->main_subtitle()->asset(), stage, xsd_dtd_directory, notes, state); + verify_subtitle_asset (reel->main_subtitle()->asset(), stage, *xsd_dtd_directory, notes, state); } have_main_subtitle = true; } else { @@ -1276,7 +1279,7 @@ dcp::verify ( for (auto i: reel->closed_captions()) { verify_closed_caption_reel (i, notes); if (i->asset_ref().resolved()) { - verify_closed_caption_asset (i->asset(), stage, xsd_dtd_directory, notes); + verify_closed_caption_asset (i->asset(), stage, *xsd_dtd_directory, notes); } } @@ -1384,7 +1387,7 @@ dcp::verify ( for (auto pkl: dcp->pkls()) { stage ("Checking PKL", pkl->file()); - validate_xml (pkl->file().get(), xsd_dtd_directory, notes); + validate_xml (pkl->file().get(), *xsd_dtd_directory, notes); if (pkl_has_encrypted_assets(dcp, pkl)) { cxml::Document doc ("PackingList"); doc.read_file (pkl->file().get()); @@ -1396,7 +1399,7 @@ dcp::verify ( if (dcp->asset_map_path()) { stage ("Checking ASSETMAP", dcp->asset_map_path().get()); - validate_xml (dcp->asset_map_path().get(), xsd_dtd_directory, notes); + validate_xml (dcp->asset_map_path().get(), *xsd_dtd_directory, notes); } else { notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::MISSING_ASSETMAP}); } -- cgit v1.2.3