cli: Add extra paths in detect()
on Windows (#25765)
I'm already integrating CLI into MSYS2 package, and this patche helped
me to make it work like in Arch:
https://github.com/msys2/MINGW-packages/pull/23537. used the same way as
in [Linux
implementation](6856e869fc/crates/cli/src/main.rs (L314)
)
Closes #ISSUE
Release Notes:
- N/A
This commit is contained in:
parent
aa1ab50656
commit
a8a05f208b
1 changed files with 13 additions and 6 deletions
|
@ -614,12 +614,19 @@ mod windows {
|
||||||
let path = if let Some(path) = path {
|
let path = if let Some(path) = path {
|
||||||
path.to_path_buf().canonicalize()?
|
path.to_path_buf().canonicalize()?
|
||||||
} else {
|
} else {
|
||||||
std::env::current_exe()?
|
let cli = std::env::current_exe()?;
|
||||||
.parent()
|
let dir = cli.parent().context("no parent path for cli")?;
|
||||||
.context("no parent path for cli")?
|
|
||||||
.parent()
|
// ../Zed.exe is the standard, lib/zed is for MSYS2, ./zed.exe is for the target
|
||||||
.context("no parent path for cli folder")?
|
// directory in development builds.
|
||||||
.join("Zed.exe")
|
let possible_locations = ["../Zed.exe", "../lib/zed/zed-editor.exe", "./zed.exe"];
|
||||||
|
possible_locations
|
||||||
|
.iter()
|
||||||
|
.find_map(|p| dir.join(p).canonicalize().ok().filter(|path| path != &cli))
|
||||||
|
.context(format!(
|
||||||
|
"could not find any of: {}",
|
||||||
|
possible_locations.join(", ")
|
||||||
|
))?
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(App(path))
|
Ok(App(path))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue