X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fext.cc;h=ec34f147216d97af091fdaaeec060c9620403fef;hp=feba68c1f6eec9c15951b1fa70cf010b6843fafd;hb=6e93ff6ac5b514d1b8dd9ccb2d6372576a52761a;hpb=32cb43f74ff60d37e809e2e70e751574d6c286b2 diff --git a/src/lib/ext.cc b/src/lib/ext.cc index feba68c1f..ec34f1472 100644 --- a/src/lib/ext.cc +++ b/src/lib/ext.cc @@ -57,6 +57,7 @@ extern "C" { #include } #include +#include #include @@ -90,6 +91,18 @@ count (boost::filesystem::path dir, uint64_t& total_bytes) } } + +static +void +set_timestamps_to_now (boost::filesystem::path path) +{ + auto const now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ext4_mtime_set (path.generic_string().c_str(), now); + ext4_ctime_set (path.generic_string().c_str(), now); + ext4_atime_set (path.generic_string().c_str(), now); +} + + static string write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total_remaining, uint64_t total, Nanomsg* nanomsg) @@ -151,6 +164,8 @@ write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total ext4_fclose (&out); delete[] buffer; + set_timestamps_to_now (to); + return digester.get (); } @@ -231,6 +246,7 @@ copy (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total_ if (r != EOK) { throw CopyError (String::compose("Failed to create directory %1", cr.generic_string()), r); } + set_timestamps_to_now (cr); for (directory_iterator i = directory_iterator(from); i != directory_iterator(); ++i) { copy (i->path(), cr, total_remaining, total, copied_files, nanomsg);