mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-18 22:31:35 +03:00
fix: always create XDG cache directory even if user has set a custom one (#956)
This commit is contained in:
parent
2febbee595
commit
bf91f35d3e
@ -49,11 +49,13 @@ impl Default for Preview {
|
|||||||
let preview = toml::from_str::<Outer>(&MERGED_YAZI).unwrap().preview;
|
let preview = toml::from_str::<Outer>(&MERGED_YAZI).unwrap().preview;
|
||||||
check_validation(preview.validate());
|
check_validation(preview.validate());
|
||||||
|
|
||||||
let cache_dir =
|
let mut cache_dir = Xdg::cache_dir();
|
||||||
preview.cache_dir.filter(|p| !p.is_empty()).map_or_else(Xdg::cache_dir, expand_path);
|
std::fs::create_dir_all(&cache_dir).expect("Failed to create cache directory");
|
||||||
|
|
||||||
if !cache_dir.is_dir() {
|
// If the `cache_dir` is set in the configuration file, use it instead
|
||||||
std::fs::create_dir(&cache_dir).expect("Failed to create cache directory");
|
if let Some(p) = preview.cache_dir.filter(|s| !s.is_empty()).map(expand_path) {
|
||||||
|
cache_dir = p;
|
||||||
|
std::fs::create_dir_all(&cache_dir).expect("Failed to create cache directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
Preview {
|
Preview {
|
||||||
|
Loading…
Reference in New Issue
Block a user