mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-26 09:43:51 +01:00
show skip message when asset cache is not found
This commit is contained in:
parent
7fe4fdf33d
commit
d5f737f402
@ -1,5 +1,6 @@
|
||||
use std::borrow::Cow;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
|
||||
use clap::crate_version;
|
||||
|
||||
@ -52,6 +53,14 @@ pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<Highlighti
|
||||
|
||||
fn clear_asset(filename: &str, description: &str) {
|
||||
print!("Clearing {} ... ", description);
|
||||
fs::remove_file(PROJECT_DIRS.cache_dir().join(filename)).ok();
|
||||
println!("okay");
|
||||
let path = PROJECT_DIRS.cache_dir().join(filename);
|
||||
match fs::remove_file(&path) {
|
||||
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
||||
println!("skipped (not present)");
|
||||
}
|
||||
Err(err) => {
|
||||
println!("could not remove the cache file {:?}: {}", &path, err);
|
||||
}
|
||||
Ok(_) => println!("okay"),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user