mirror of
https://github.com/sharkdp/bat
synced 2024-11-27 22:30:33 +00:00
show skip message when asset cache is not found
This commit is contained in:
parent
7fe4fdf33d
commit
d5f737f402
1 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::io;
|
||||||
|
|
||||||
use clap::crate_version;
|
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) {
|
fn clear_asset(filename: &str, description: &str) {
|
||||||
print!("Clearing {} ... ", description);
|
print!("Clearing {} ... ", description);
|
||||||
fs::remove_file(PROJECT_DIRS.cache_dir().join(filename)).ok();
|
let path = PROJECT_DIRS.cache_dir().join(filename);
|
||||||
println!("okay");
|
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 a new issue