X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcontent.cc;fp=src%2Flib%2Fcontent.cc;h=1682b863d8d5ac3154f9a0a0b523042922775bff;hb=15d98128799c2902a3fc046792d1456a275b756b;hp=0171563ae5d041d1fb9ee97812bd17e8b2c2bf6f;hpb=f09a7994fb374d4a6dde0224eb1dfb5cbb83bc0b;p=dcpomatic.git diff --git a/src/lib/content.cc b/src/lib/content.cc index 0171563ae..1682b863d 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -96,10 +96,10 @@ Content::Content (cxml::ConstNodePtr node) auto const mod = i->optional_number_attribute("mtime"); if (mod) { _last_write_times.push_back (*mod); - } else if (boost::filesystem::exists(i->content())) { - _last_write_times.push_back (boost::filesystem::last_write_time(i->content())); } else { - _last_write_times.push_back (0); + boost::system::error_code ec; + auto last_write = boost::filesystem::last_write_time(i->content(), ec); + _last_write_times.push_back (ec ? 0 : last_write); } } _digest = node->optional_string_child ("Digest").get_value_or ("X"); @@ -192,7 +192,9 @@ Content::examine (shared_ptr, shared_ptr job) _last_write_times.clear (); for (auto i: _paths) { - _last_write_times.push_back (boost::filesystem::last_write_time(i)); + boost::system::error_code ec; + auto last_write = boost::filesystem::last_write_time(i, ec); + _last_write_times.push_back (ec ? 0 : last_write); } } @@ -345,7 +347,9 @@ Content::set_paths (vector paths) _paths = paths; _last_write_times.clear (); for (auto i: _paths) { - _last_write_times.push_back (boost::filesystem::last_write_time(i)); + boost::system::error_code ec; + auto last_write = boost::filesystem::last_write_time(i, ec); + _last_write_times.push_back (ec ? 0 : last_write); } } } @@ -508,5 +512,7 @@ Content::add_path (boost::filesystem::path p) { boost::mutex::scoped_lock lm (_mutex); _paths.push_back (p); - _last_write_times.push_back (boost::filesystem::last_write_time(p)); + boost::system::error_code ec; + auto last_write = boost::filesystem::last_write_time(p, ec); + _last_write_times.push_back (ec ? 0 : last_write); }