mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
212670d863
commit
1e75e3a268
2 changed files with 6 additions and 8 deletions
|
|
@ -55,16 +55,16 @@ impl Stream {
|
||||||
async fn socket_file() -> io::Result<&'static std::path::PathBuf> {
|
async fn socket_file() -> io::Result<&'static std::path::PathBuf> {
|
||||||
use tokio::{fs::DirBuilder, sync::OnceCell};
|
use tokio::{fs::DirBuilder, sync::OnceCell};
|
||||||
use yazi_fs::Xdg;
|
use yazi_fs::Xdg;
|
||||||
static ONCE: tokio::sync::OnceCell<std::path::PathBuf> = OnceCell::const_new();
|
|
||||||
|
|
||||||
|
static ONCE: tokio::sync::OnceCell<std::path::PathBuf> = OnceCell::const_new();
|
||||||
ONCE
|
ONCE
|
||||||
.get_or_try_init(|| async move {
|
.get_or_try_init(|| async move {
|
||||||
let p = Xdg::runtime_dir();
|
let p = Xdg::runtime_dir();
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
DirBuilder::new().recursive(true).create(p).await?;
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
DirBuilder::new().mode(0o700).recursive(true).create(p).await?;
|
DirBuilder::new().mode(0o700).recursive(true).create(p).await?;
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
DirBuilder::new().recursive(true).create(p).await?;
|
||||||
|
|
||||||
Ok(p.join(".dds.sock"))
|
Ok(p.join(".dds.sock"))
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,15 @@ impl Xdg {
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
dirs::config_dir()
|
dirs::config_dir().map(|p| p.join("yazi\\config")).expect("Failed to get config directory")
|
||||||
.map(|p| p.join("yazi").join("config"))
|
|
||||||
.expect("Failed to get config directory")
|
|
||||||
}
|
}
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
env::var_os("XDG_CONFIG_HOME")
|
env::var_os("XDG_CONFIG_HOME")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
.filter(|p| p.is_absolute())
|
.filter(|p| p.is_absolute())
|
||||||
.or_else(|| dirs::home_dir().map(|h| h.join(".config")))
|
|
||||||
.map(|p| p.join("yazi"))
|
.map(|p| p.join("yazi"))
|
||||||
|
.or_else(|| dirs::home_dir().map(|h| h.join(".config/yazi")))
|
||||||
.expect("Failed to get config directory")
|
.expect("Failed to get config directory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -55,8 +53,8 @@ impl Xdg {
|
||||||
env::var_os("XDG_CACHE_HOME")
|
env::var_os("XDG_CACHE_HOME")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
.filter(|p| p.is_absolute())
|
.filter(|p| p.is_absolute())
|
||||||
.or_else(|| dirs::home_dir().map(|h| h.join(".cache")))
|
|
||||||
.map(|p| p.join("yazi"))
|
.map(|p| p.join("yazi"))
|
||||||
|
.or_else(|| dirs::home_dir().map(|h| h.join(".cache/yazi")))
|
||||||
.expect("Failed to get state directory")
|
.expect("Failed to get state directory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue