From 3150bd92d6162ba248bc28fd4d40bd0d6238e1af Mon Sep 17 00:00:00 2001 From: JJ Liebig Date: Fri, 4 Sep 2026 01:05:35 +0200 Subject: fix(integration): resolve Devin config on Windows (#3595) refs #2724 --- src/integration/env.rs | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/integration/env.rs') diff --git a/src/integration/env.rs b/src/integration/env.rs index 8f3a9e65..c4ee1c34 100644 --- a/src/integration/env.rs +++ b/src/integration/env.rs @@ -76,6 +76,11 @@ pub(crate) fn devin_dir() -> io::Result { return expand_tilde_path(PathBuf::from(value)).map(|path| path.join("devin")); } + #[cfg(windows)] + if let Some(value) = std::env::var_os("APPDATA").filter(|value| !value.is_empty()) { + return Ok(PathBuf::from(value).join("devin")); + } + Ok(home_dir()?.join(".config").join("devin")) } @@ -215,7 +220,31 @@ pub(crate) fn home_dir() -> io::Result { } #[cfg(test)] -pub(crate) fn integration_env_lock() -> MutexGuard<'static, ()> { +pub(crate) struct IntegrationEnvLock { + _guard: MutexGuard<'static, ()>, + #[cfg(windows)] + appdata: Option, +} + +#[cfg(test)] +impl Drop for IntegrationEnvLock { + fn drop(&mut self) { + #[cfg(windows)] + if let Some(appdata) = self.appdata.take() { + std::env::set_var("APPDATA", appdata); + } else { + std::env::remove_var("APPDATA"); + } + } +} + +#[cfg(test)] +pub(crate) fn integration_env_lock() -> IntegrationEnvLock { static LOCK: OnceLock> = OnceLock::new(); - LOCK.get_or_init(|| Mutex::new(())).lock().unwrap() + let guard = LOCK.get_or_init(|| Mutex::new(())).lock().unwrap(); + IntegrationEnvLock { + _guard: guard, + #[cfg(windows)] + appdata: std::env::var_os("APPDATA"), + } } -- cgit v1.2.3