mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: only create mapped local working directories for virtual file systems (#3207)
This commit is contained in:
parent
d905cbf2d7
commit
51635996e0
1 changed files with 12 additions and 4 deletions
|
|
@ -53,8 +53,7 @@ impl Cwd {
|
||||||
}
|
}
|
||||||
|
|
||||||
tokio::task::spawn_blocking(move || {
|
tokio::task::spawn_blocking(move || {
|
||||||
let path = CWD.path();
|
let path = CWD.ensure_cache();
|
||||||
std::fs::create_dir_all(&path).ok();
|
|
||||||
|
|
||||||
_ = set_current_dir(&path);
|
_ = set_current_dir(&path);
|
||||||
let cur = current_dir().unwrap_or_default();
|
let cur = current_dir().unwrap_or_default();
|
||||||
|
|
@ -62,12 +61,21 @@ impl Cwd {
|
||||||
unsafe { std::env::set_var("PWD", path) }
|
unsafe { std::env::set_var("PWD", path) }
|
||||||
SYNCING.store(false, Ordering::Relaxed);
|
SYNCING.store(false, Ordering::Relaxed);
|
||||||
|
|
||||||
let path = CWD.path();
|
let path = CWD.ensure_cache();
|
||||||
if cur != path {
|
if cur != path {
|
||||||
std::fs::create_dir_all(&path).ok();
|
|
||||||
set_current_dir(&path).ok();
|
set_current_dir(&path).ok();
|
||||||
unsafe { std::env::set_var("PWD", path) }
|
unsafe { std::env::set_var("PWD", path) }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ensure_cache(&self) -> PathBuf {
|
||||||
|
let url = self.0.load();
|
||||||
|
if let Some(p) = provider::cache(url.as_ref()) {
|
||||||
|
std::fs::create_dir_all(&p).ok();
|
||||||
|
p
|
||||||
|
} else {
|
||||||
|
url.loc.to_path()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue