@@ -9,7 +9,7 @@ struct SourcePath;
99/* *
1010 * A source accessor that uses the Unix filesystem.
1111 */
12- struct PosixSourceAccessor : virtual SourceAccessor
12+ class PosixSourceAccessor : virtual public SourceAccessor
1313{
1414 /* *
1515 * Optional root path to prefix all operations into the native file
@@ -18,8 +18,12 @@ struct PosixSourceAccessor : virtual SourceAccessor
1818 */
1919 const std::filesystem::path root;
2020
21+ const bool trackLastModified = false ;
22+
23+ public:
24+
2125 PosixSourceAccessor ();
22- PosixSourceAccessor (std::filesystem::path && root);
26+ PosixSourceAccessor (std::filesystem::path && root, bool trackLastModified = false );
2327
2428 /* *
2529 * The most recent mtime seen by lstat(). This is a hack to
@@ -43,6 +47,9 @@ struct PosixSourceAccessor : virtual SourceAccessor
4347 * Create a `PosixSourceAccessor` and `SourcePath` corresponding to
4448 * some native path.
4549 *
50+ * @param Whether the accessor should return a non-null getLastModified.
51+ * When true the accessor must be used only by a single thread.
52+ *
4653 * The `PosixSourceAccessor` is rooted as far up the tree as
4754 * possible, (e.g. on Windows it could scoped to a drive like
4855 * `C:\`). This allows more `..` parent accessing to work.
@@ -64,7 +71,12 @@ struct PosixSourceAccessor : virtual SourceAccessor
6471 * and
6572 * [`std::filesystem::path::relative_path`](https://en.cppreference.com/w/cpp/filesystem/path/relative_path).
6673 */
67- static SourcePath createAtRoot (const std::filesystem::path & path);
74+ static SourcePath createAtRoot (const std::filesystem::path & path, bool trackLastModified = false );
75+
76+ std::optional<std::time_t > getLastModified () override
77+ {
78+ return trackLastModified ? std::optional{mtime} : std::nullopt ;
79+ }
6880
6981private:
7082
0 commit comments