diff options
Diffstat (limited to 'src/util/file_watcher.h')
| -rw-r--r-- | src/util/file_watcher.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/util/file_watcher.h b/src/util/file_watcher.h new file mode 100644 index 0000000..2766a43 --- /dev/null +++ b/src/util/file_watcher.h @@ -0,0 +1,33 @@ +// file_watcher.h - Hot-reload file change detection (debug only) + +#ifndef FILE_WATCHER_H_ +#define FILE_WATCHER_H_ + +#if !defined(STRIP_ALL) + +#include <string> +#include <vector> +#include <ctime> + +class FileWatcher { + public: + FileWatcher() = default; + + void add_file(const char* path); + bool check_changes(); + void reset(); + + private: + struct WatchEntry { + std::string path; + time_t last_mtime; + bool changed; + }; + + std::vector<WatchEntry> files_; + time_t get_mtime(const char* path); +}; + +#endif // !defined(STRIP_ALL) + +#endif // FILE_WATCHER_H_ |
