From 6f8af46def86d5e6041b19bf900a7fd4b35cc5dc Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 16 Feb 2020 09:36:31 -0800 Subject: [PATCH] export WEZTERM_EXECUTABLE and WEZTERM_CONFIG_FILE to the env This allows child processes to "do something" with that information. For example, portable wezterm deployments can use these paths to bootstrap some other portable config paths. refs: https://github.com/wez/wezterm/issues/152 --- src/config/mod.rs | 2 ++ src/main.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/config/mod.rs b/src/config/mod.rs index 924801514..4cf626af0 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -593,6 +593,8 @@ impl Config { // Compute but discard the key bindings here so that we raise any // problems earlier than we use them. let _ = cfg.key_bindings()?; + + std::env::set_var("WEZTERM_CONFIG_FILE", p); return Ok((cfg.compute_extra_defaults(Some(p)), Some(p.to_path_buf()))); } diff --git a/src/main.rs b/src/main.rs index 2de7a7a9d..c764e707a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -689,6 +689,10 @@ fn maybe_show_configuration_error_window() { } fn run() -> anyhow::Result<()> { + if let Ok(exe) = std::env::current_exe() { + std::env::set_var("WEZTERM_EXECUTABLE", exe); + } + // This is a bit gross. // In order to not to automatically open a standard windows console when // we run, we use the windows_subsystem attribute at the top of this