1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-25 21:07:39 +03:00

env: put appimage bin dir into path

This allows `wezterm connect unix` to work for me when using the
appimage.

refs: https://github.com/wez/wezterm/issues/1359
This commit is contained in:
Wez Furlong 2021-12-01 08:42:02 -07:00
parent 30fd56c35f
commit ab8907e735

View File

@ -23,6 +23,19 @@ pub fn fixup_appimage() {
// Let's just unset that from the environment!
std::env::remove_var("ARGV0");
// Since our AppImage includes multiple utilities, we want to
// be able to use them, so add that location to the PATH!
// WEZTERM_EXECUTABLE_DIR is set by `set_wezterm_executable`
// which is called before `fixup_appimage`
if let Some(dir) = std::env::var_os("WEZTERM_EXECUTABLE_DIR") {
if let Some(path) = std::env::var_os("PATH") {
let mut paths = std::env::split_paths(&path).collect::<Vec<_>>();
paths.insert(0, PathBuf::from(dir));
let new_path = std::env::join_paths(paths).expect("unable to update PATH");
std::env::set_var("PATH", &new_path);
}
}
// This AppImage feature allows redirecting HOME and XDG_CONFIG_HOME
// to live alongside the executable for portable use:
// https://github.com/AppImage/AppImageKit/issues/368