Skip to content

Commit 286d8d9

Browse files
committed
Ignoring temporary files during download
1 parent 61c233d commit 286d8d9

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/watcher.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,20 @@ impl Watcher {
140140

141141
}
142142

143-
fn handle_file<P: Into<PathBuf>>(&self, path: P) -> LLResult<String> {
144-
145-
let epw = Epw::from_file(path)?;
146-
let res = &self.cse.get(epw)?;
147-
res.save()
148-
143+
fn handle_file(&self, path: &PathBuf) -> LLResult<String> {
144+
let extension = path.extension().and_then(|ext| { ext.to_str() });
145+
match extension {
146+
Some(s) => if s.eq_ignore_ascii_case("zip") {
147+
let epw = Epw::from_file(path)?;
148+
let res = &self.cse.get(epw)?;
149+
res.save()
150+
} else {
151+
Err(LLError::new(format!("=> Ignoring non-zip: {}", path.to_str().unwrap())))
152+
}
153+
None => {
154+
Err(LLError::new(format!("=> Ignoring: {}", path.to_str().unwrap())))
155+
}
156+
}
149157
}
150158

151159
}

0 commit comments

Comments
 (0)