Check if changed exercise file exists before calling verify.

This commit is contained in:
Fredrik Jambrén 2019-07-11 23:54:18 +02:00
parent 70946b85e5
commit ba85ca32c4
1 changed files with 1 additions and 1 deletions

View File

@ -101,7 +101,7 @@ fn watch(exercises: &[Exercise]) -> notify::Result<()> {
match rx.recv() { match rx.recv() {
Ok(event) => match event { Ok(event) => match event {
DebouncedEvent::Create(b) | DebouncedEvent::Chmod(b) | DebouncedEvent::Write(b) => { DebouncedEvent::Create(b) | DebouncedEvent::Chmod(b) | DebouncedEvent::Write(b) => {
if b.extension() == Some(OsStr::new("rs")) { if b.extension() == Some(OsStr::new("rs")) && b.exists() {
println!("----------**********----------\n"); println!("----------**********----------\n");
let filepath = b.as_path().canonicalize().unwrap(); let filepath = b.as_path().canonicalize().unwrap();
let exercise = exercises let exercise = exercises