check if /tmp/hunter-previews exists before deleting

This commit is contained in:
rabite 2019-07-25 21:29:10 +02:00
parent 8cb02c59be
commit 3b80c3b20f
1 changed files with 5 additions and 3 deletions

View File

@ -375,9 +375,11 @@ impl Previewer {
{
kill_proc().log();
// Delete files left by graphical PDF previews, etc.
std::fs::remove_dir_all("/tmp/hunter-previews/")
.map_err(HError::from)
.log();
if std::path::Path::new("/tmp/hunter-previews").exists() {
std::fs::remove_dir_all("/tmp/hunter-previews/")
.map_err(HError::from)
.log();
}
if file.kind == Kind::Directory {
let preview = Previewer::preview_dir(&file,