diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/src/main.rs b/src/main.rs index 919844b..458ecf4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -95,11 +95,13 @@ impl Monitor { /// Was the file modified since the last check? fn check_file_modified(&mut self, lease_file_path: &str) -> bool { - let metadata = fs::metadata(&lease_file_path); + let metadata = match fs::metadata(&lease_file_path) { + Ok(m) => m, + Err(_) => return false, + }; let current_timestamp = metadata - .expect("Unsupported platform") .modified() - .expect("Error getting modification timestamp"); + .expect("Unsupported platform: cannot read file mtime"); let last_timestamp = self .timestamps