diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-11-27 01:04:37 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-11-28 21:08:08 +0100 |
| commit | b2d850326af5c9ffc6486e4cc40bef6e1c051a6f (patch) | |
| tree | 3c58777c4804f4967f9246f23cd9e7b1dabb6493 /src/lib/content.cc | |
| parent | 7926a03f67cf0a371e43b5d8b4d075c7a789a478 (diff) | |
Extract part of the content change job to Content.
Diffstat (limited to 'src/lib/content.cc')
| -rw-r--r-- | src/lib/content.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index 064bae553..a56891689 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -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()); +} |
