Disable audio cache when there is an error trying to create a file

This commit is contained in:
Laurent Louf 2020-07-25 01:20:08 +02:00
parent e3abb87da1
commit f075a75aee

View file

@ -86,8 +86,13 @@ impl Cache {
mkdir_existing(path.parent().unwrap()).unwrap(); mkdir_existing(path.parent().unwrap()).unwrap();
let mut cache_file = File::create(path).unwrap(); let mut cache_file = File::create(path)
::std::io::copy(contents, &mut cache_file).unwrap(); match cache_file {
Ok(file) => ::std::io::copy(contents, &mut file).unwrap(),
Err(error) => {
self.use_audio_cache = false
},
};
} }
} }
} }