summaryrefslogtreecommitdiff
path: root/src/lib/content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-11-27 01:04:37 +0100
committerCarl Hetherington <cth@carlh.net>2021-11-28 21:12:00 +0100
commit07b21bb92a8d54c6c03de9aadc63ab93b65d9bc5 (patch)
tree5054e3da62eab53c31a01962d982fd1a89112751 /src/lib/content.cc
parent121988b23c485ccb5ac8220c1776d10cb33e0db7 (diff)
Extract part of the content change job to Content.
Diffstat (limited to 'src/lib/content.cc')
-rw-r--r--src/lib/content.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc
index b6f7ebbaa..370139d12 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -545,3 +545,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());
+}