Skip to content

Commit

Permalink
allow empty watcher path
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNumbat committed Sep 28, 2024
1 parent fc0fb77 commit a4ae343
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rpp/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using File_Time = u64;
struct Write_Watcher {

explicit Write_Watcher(String_View path) noexcept : path_(rpp::move(path)) {
if(path_.empty()) return;
Opt<File_Time> time = last_write_time(path_);
if(time.ok()) last_write_time_ = *time;
}
Expand All @@ -32,6 +33,7 @@ struct Write_Watcher {
}

[[nodiscard]] bool poll() noexcept {
if(path_.empty()) return false;
Opt<File_Time> time = last_write_time(path_);
if(!time.ok()) return false;
bool ret = before(last_write_time_, *time);
Expand Down

0 comments on commit a4ae343

Please sign in to comment.