Extract part of the content change job to Content.
[dcpomatic.git] / src / lib / content.cc
index 064bae553a4511cd7c2c52d07312e486b0f47b7c..a56891689c201f2d23e1f8eec6c20ae2d3c4e788 100644 (file)
@@ -543,3 +543,18 @@ Content::add_path (boost::filesystem::path p)
        auto last_write = boost::filesystem::last_write_time(p, ec);
        _last_write_times.push_back (ec ? 0 : last_write);
 }
+
+
+bool
+Content::changed () const
+{
+       bool write_time_changed = false;
+       for (auto i = 0U; i < _paths.size(); ++i) {
+               if (boost::filesystem::last_write_time(_paths[i]) != last_write_time(i)) {
+                       write_time_changed = true;
+                       break;
+               }
+       }
+
+       return (write_time_changed || calculate_digest() != digest());
+}