yazi/yazi-boot/src/actions/clear_cache.rs
Mika Vilpas f0cb365839
feat: allow setting YAZI_ID as a command line argument (#1305)
Co-authored-by: sxyazi <sxyazi@gmail.com>
2024-07-18 15:04:46 +08:00

18 lines
455 B
Rust

use yazi_config::PREVIEW;
use yazi_shared::Xdg;
use super::Actions;
impl Actions {
pub(super) fn clear_cache() {
if PREVIEW.cache_dir == Xdg::cache_dir() {
println!("Clearing cache directory: \n{:?}", PREVIEW.cache_dir);
std::fs::remove_dir_all(&PREVIEW.cache_dir).unwrap();
} else {
println!(
"You've changed the default cache directory, for your data's safety, please clear it manually: \n{:?}",
PREVIEW.cache_dir
);
}
}
}