mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-18 14:21:32 +03:00
fix: move the DDS socket file out of the cache directory to avoid being affected by yazi --clear-cache
This commit is contained in:
parent
681612f976
commit
d01e18067c
@ -49,15 +49,10 @@ 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 mut cache_dir = Xdg::cache_dir();
|
let 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");
|
std::fs::create_dir_all(&cache_dir).expect("Failed to create cache directory");
|
||||||
|
|
||||||
// If the `cache_dir` is set in the configuration file, use it instead
|
|
||||||
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 {
|
||||||
tab_size: preview.tab_size,
|
tab_size: preview.tab_size,
|
||||||
max_width: preview.max_width,
|
max_width: preview.max_width,
|
||||||
|
@ -49,11 +49,12 @@ impl Stream {
|
|||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn socket_file() -> std::path::PathBuf {
|
fn socket_file() -> std::path::PathBuf {
|
||||||
|
use std::env::temp_dir;
|
||||||
|
|
||||||
use uzers::Users;
|
use uzers::Users;
|
||||||
use yazi_shared::Xdg;
|
|
||||||
|
|
||||||
use crate::USERS_CACHE;
|
use crate::USERS_CACHE;
|
||||||
|
|
||||||
Xdg::cache_dir().join(format!(".dds-{}.sock", USERS_CACHE.get_current_uid()))
|
temp_dir().join(format!(".yazi_dds-{}.sock", USERS_CACHE.get_current_uid()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user