mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: use cleaned and normalized $PWD as startup CWD to avoid MSYS2/git-bash path quirks
This commit is contained in:
parent
feeea673f1
commit
6df9d13a2b
2 changed files with 6 additions and 4 deletions
|
|
@ -35,6 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
|
||||||
- Normalize `\\?\`-prefixed Verbatim paths when creating relative symlinks on Windows ([#4067])
|
- Normalize `\\?\`-prefixed Verbatim paths when creating relative symlinks on Windows ([#4067])
|
||||||
- Keep package hashes indifferent to line endings when `ya pkg` pulls packages ([#4064])
|
- Keep package hashes indifferent to line endings when `ya pkg` pulls packages ([#4064])
|
||||||
- Use WebP as `magick` preset preloader cache format to keep image transparency ([#4065])
|
- Use WebP as `magick` preset preloader cache format to keep image transparency ([#4065])
|
||||||
|
- Use cleaned and normalized `$PWD` as startup CWD to avoid MSYS2/git-bash path quirks
|
||||||
|
|
||||||
### Improved
|
### Improved
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use arc_swap::ArcSwap;
|
||||||
use yazi_shared::url::{AsUrl, Url, UrlBuf, UrlLike};
|
use yazi_shared::url::{AsUrl, Url, UrlBuf, UrlLike};
|
||||||
use yazi_shim::cell::RoCell;
|
use yazi_shim::cell::RoCell;
|
||||||
|
|
||||||
use crate::{FsUrl, Xdg};
|
use crate::{FsUrl, Xdg, path::clean_url};
|
||||||
|
|
||||||
pub static CWD: RoCell<Cwd> = RoCell::new();
|
pub static CWD: RoCell<Cwd> = RoCell::new();
|
||||||
|
|
||||||
|
|
@ -18,13 +18,14 @@ impl Deref for Cwd {
|
||||||
|
|
||||||
impl Default for Cwd {
|
impl Default for Cwd {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let p = std::env::var_os("PWD")
|
let u = std::env::var_os("PWD")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
.filter(|p| p.is_absolute())
|
.filter(|p| p.is_absolute())
|
||||||
.or_else(|| current_dir().ok())
|
.map(clean_url)
|
||||||
|
.or_else(|| current_dir().ok().map(UrlBuf::from))
|
||||||
.expect("failed to get current working directory");
|
.expect("failed to get current working directory");
|
||||||
|
|
||||||
Self(ArcSwap::new(Arc::new(UrlBuf::from(p))))
|
Self(ArcSwap::new(Arc::new(u)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue