diff --git a/crates/gpui_util/src/lib.rs b/crates/gpui_util/src/lib.rs index a946ea10c2..37279de56e 100644 --- a/crates/gpui_util/src/lib.rs +++ b/crates/gpui_util/src/lib.rs @@ -95,8 +95,12 @@ pub fn get_powershell() -> Option { } fn find_pwsh_in_scoop() -> Option { - let pwsh_exe = - PathBuf::from(std::env::var_os("USERPROFILE")?).join("scoop\\shims\\pwsh.exe"); + // Scoop can be installed to a custom location; $SCOOP points at the + // scoop root in that case and defaults to %USERPROFILE%\scoop otherwise. + let scoop_dir = std::env::var_os("SCOOP").map(PathBuf::from).or_else(|| { + std::env::var_os("USERPROFILE").map(|home| PathBuf::from(home).join("scoop")) + })?; + let pwsh_exe = scoop_dir.join("shims").join("pwsh.exe"); pwsh_exe.is_file().then_some(pwsh_exe) }