mux: prefer to use wezterm relative to current exe

I think this will help with some PATH related issues, such as
refs: https://github.com/wez/wezterm/issues/1359
This commit is contained in:
Wez Furlong committed 2021-12-02 21:52:17 -07:00
1 parent 6c26b9e524
commit cabcfb70f9
2 files changed
+21 -11

No files matched your search

-3
View File
@@ -1158,9 +1158,6 @@ pub struct Config {
#[serde(default = "default_true")]
pub use_dead_keys: bool,
#[serde(default)]
pub use_local_build_for_proxy: bool,
#[serde(default)]
pub launch_menu: Vec<SpawnCommand>,
+21 -8
View File
@@ -411,17 +411,30 @@ impl Reconnectable {
}
/// If debugging on wez's machine, use a path specific to that machine.
fn wezterm_bin_path(path: &Option<String>) -> &str {
fn wezterm_bin_path(path: &Option<String>) -> String {
match path.as_ref() {
Some(p) => p,
Some(p) => p.clone(),
None => {
if !configuration().use_local_build_for_proxy {
"wezterm"
} else if cfg!(debug_assertions) {
"/home/wez/wez-personal/wezterm/target/debug/wezterm"
} else {
"/home/wez/wez-personal/wezterm/target/release/wezterm"
if let Ok(exe) = std::env::current_exe() {
if let Some(exe) = exe
.with_file_name(if cfg!(windows) {
"wezterm.exe"
} else {
"wezterm"
})
.to_str()
{
return exe.to_string();
}
}
// Catch-all: ask kernel to resolve via PATH
if cfg!(windows) {
"wezterm.exe"
} else {
"wezterm"
}
.to_string()
}
}
}