mirror of
https://github.com/denisidoro/navi
synced 2024-11-28 06:20:21 +00:00
Fix preview: handle Windows NT UNC paths (\\?\C:\foo
)
This commit is contained in:
parent
b9283f6718
commit
ea95dfec48
3 changed files with 15 additions and 0 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -244,6 +244,12 @@ dependencies = [
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dunce"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "edit"
|
name = "edit"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
|
@ -455,6 +461,7 @@ dependencies = [
|
||||||
"crossterm",
|
"crossterm",
|
||||||
"dns_common",
|
"dns_common",
|
||||||
"dns_common_derive",
|
"dns_common_derive",
|
||||||
|
"dunce",
|
||||||
"edit",
|
"edit",
|
||||||
"etcetera",
|
"etcetera",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
|
|
@ -37,6 +37,9 @@ dns_common_derive = { version = "0.2.1" }
|
||||||
dns_common = { version = "0.2.1", default-features = false, features = ["yaml", "json"] }
|
dns_common = { version = "0.2.1", default-features = false, features = ["yaml", "json"] }
|
||||||
unicode-width = "0.1.10"
|
unicode-width = "0.1.10"
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
dunce = "1"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "navi"
|
name = "navi"
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
|
@ -78,6 +78,11 @@ fn follow_symlink(pathbuf: PathBuf) -> Result<PathBuf> {
|
||||||
|
|
||||||
fn exe_pathbuf() -> Result<PathBuf> {
|
fn exe_pathbuf() -> Result<PathBuf> {
|
||||||
let pathbuf = std::env::current_exe().context("Unable to acquire executable's path")?;
|
let pathbuf = std::env::current_exe().context("Unable to acquire executable's path")?;
|
||||||
|
|
||||||
|
#[cfg(target_family = "windows")]
|
||||||
|
let pathbuf = dunce::canonicalize(pathbuf)?;
|
||||||
|
|
||||||
|
debug!(current_exe = ?pathbuf);
|
||||||
follow_symlink(pathbuf)
|
follow_symlink(pathbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue