diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-08-07 23:10:28 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-07 23:10:28 +0300 |
| commit | 50ddc06f00ec69ede35fd5488a260dec2b74e98a (patch) | |
| tree | 2a01f30600ccfea600040476703cf7de50087156 /src/integration/env.rs | |
| parent | 7d77e927eba265ea864485bf99411abcf62d977d (diff) | |
feat: support all agent integrations on windows (#2496)
Diffstat (limited to 'src/integration/env.rs')
| -rw-r--r-- | src/integration/env.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/integration/env.rs b/src/integration/env.rs index d76ce66c..e86f6ee8 100644 --- a/src/integration/env.rs +++ b/src/integration/env.rs @@ -22,9 +22,13 @@ pub(crate) const GROK_CONFIG_DIR_ENV_VAR: &str = "GROK_CONFIG_DIR"; /// The grok CLI's own config-home override (documented alongside /// `$GROK_HOME/config.toml` and `$GROK_HOME/auth.json`). pub(crate) const GROK_HOME_ENV_VAR: &str = "GROK_HOME"; +pub(crate) const HERMES_HOME_ENV_VAR: &str = "HERMES_HOME"; pub(crate) fn apply_pane_base_env(cmd: &mut CommandBuilder) { cmd.env(crate::api::SOCKET_PATH_ENV_VAR, crate::api::socket_path()); + if let Ok(executable) = std::env::current_exe() { + cmd.env("HERDR_BIN_PATH", executable); + } } pub(crate) fn pi_extension_dir() -> io::Result<PathBuf> { @@ -122,6 +126,24 @@ pub(crate) fn kilo_dir() -> io::Result<PathBuf> { } pub(crate) fn hermes_dir() -> io::Result<PathBuf> { + if let Some(value) = std::env::var_os(HERMES_HOME_ENV_VAR).filter(|value| !value.is_empty()) { + return expand_tilde_path(PathBuf::from(value)); + } + + #[cfg(windows)] + { + let explicit_home = std::env::var_os("HOME").filter(|value| !value.is_empty()); + let profile = std::env::var_os("USERPROFILE").filter(|value| !value.is_empty()); + if let Some(home) = explicit_home.filter(|home| profile.as_ref() != Some(home)) { + return Ok(PathBuf::from(home).join(".hermes")); + } + if let Some(local_app_data) = + std::env::var_os("LOCALAPPDATA").filter(|value| !value.is_empty()) + { + return Ok(PathBuf::from(local_app_data).join("hermes")); + } + } + Ok(home_dir()?.join(".hermes")) } |
