wezterm: support portable AppImage invocation

https://github.com/AppImage/AppImageKit/issues/368 introduced a way
to maintain configuration alongside an AppImage file stored on a
flash drive:

```
wez@cube-localdomain  /tmp/portable-wezterm
9:06 130 $ ls -al
total 8720
drwxrwxr-x.  4 wez  wez      100 May  6 08:54 ./
drwxrwxrwt. 19 root root     580 May  6 09:05 ../
-rwxr-xr-x.  1 wez  wez  8929256 May  6 08:59 WezTerm-20200505-090057-31c6155f-Fedora31.AppImage*
drwxrwxr-x.  3 wez  wez       60 May  6 08:15 WezTerm-20200505-090057-31c6155f-Fedora31.AppImage.config/
drwxrwxr-x.  2 wez  wez       40 May  6 08:54 WezTerm-20200505-090057-31c6155f-Fedora31.AppImage.home/
```

When launched and these `<IMAGE>.config` and/or `<IMAGE>.home` dirs
exist, the appimage machinery will redirect the HOME and XDG_CONFIG_DIR
env vars to point to those locations instead of the normal place.

We weren't respecting XDG_CONFIG_DIR (fixed in this commit), but we also
need to take care: we don't want to re-export those locations to
children of wezterm so we need to load those values and then clean
up the environment.
This commit is contained in:
Wez Furlong committed 2020-05-06 09:11:13 -07:00
1 parent 31c6155f2b
commit c53ab60940
3 files changed
+61 -21

No files matched your search

+1 -4
View File
@@ -79,10 +79,7 @@ pub fn make_lua_context(config_dir: &Path) -> anyhow::Result<Lua> {
}
prefix_path(&mut path_array, &crate::config::HOME_DIR.join(".wezterm"));
prefix_path(
&mut path_array,
&crate::config::HOME_DIR.join(".config").join("wezterm"),
);
prefix_path(&mut path_array, &crate::config::CONFIG_DIR);
if let Ok(exe) = std::env::current_exe() {
if let Some(path) = exe.parent() {
wezterm_mod.set(