mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01: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 || {
|
||||
let path = CWD.path();
|
||||
std::fs::create_dir_all(&path).ok();
|
||||
let path = CWD.ensure_cache();
|
||||
|
||||
_ = set_current_dir(&path);
|
||||
let cur = current_dir().unwrap_or_default();
|
||||
|
|
@ -62,12 +61,21 @@ impl Cwd {
|
|||
unsafe { std::env::set_var("PWD", path) }
|
||||
SYNCING.store(false, Ordering::Relaxed);
|
||||
|
||||
let path = CWD.path();
|
||||
let path = CWD.ensure_cache();
|
||||
if cur != path {
|
||||
std::fs::create_dir_all(&path).ok();
|
||||
set_current_dir(&path).ok();
|
||||
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