X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fmap_cli.cc;h=c49964f80e7da03a80d927405804a276a0c3083f;hp=c95d7f1a1aaa4c2f3bb2b5f2eda6ddf2b80c7bb0;hb=debc0ef69468530ba482c8ed0fc6a1ac1f26b26e;hpb=be911c68ee4fdc98a8c406d0f10e9d71c69714c0 diff --git a/src/lib/map_cli.cc b/src/lib/map_cli.cc index c95d7f1a1..c49964f80 100644 --- a/src/lib/map_cli.cc +++ b/src/lib/map_cli.cc @@ -196,13 +196,20 @@ map_cli(int argc, char* argv[], std::function out) CopyError(std::string message) : std::runtime_error(message) {} }; - auto maybe_copy = [&assets, output_dir]( + vector already_copied; + + auto maybe_copy = [&assets, &already_copied, output_dir]( string asset_id, bool rename, bool hard_link, bool soft_link, boost::optional extra = boost::none ) { + + if (std::find(already_copied.begin(), already_copied.end(), asset_id) != already_copied.end()) { + return; + } + auto iter = std::find_if(assets.begin(), assets.end(), [asset_id](shared_ptr a) { return a->id() == asset_id; }); if (iter != assets.end()) { DCP_ASSERT((*iter)->file()); @@ -240,6 +247,7 @@ map_cli(int argc, char* argv[], std::function out) } } (*iter)->set_file(output_path); + already_copied.push_back(asset_id); } else { boost::system::error_code ec; boost::filesystem::remove_all(*output_dir, ec);