diff --git a/install.ps1 b/install.ps1 index 4c9ac12..f9caaf6 100644 --- a/install.ps1 +++ b/install.ps1 @@ -11,7 +11,7 @@ param( [string]$BinaryBase = $env:DOSH_BINARY_BASE, [string]$BinaryName = $env:DOSH_BINARY_NAME, [string]$BinaryVersion = $(if ($env:DOSH_BINARY_VERSION) { $env:DOSH_BINARY_VERSION } else { "latest" }), - [string]$UpdateCache = $(if ($env:DOSH_UPDATE_CACHE) { $env:DOSH_UPDATE_CACHE } else { Join-Path $HOME ".cache\dosh\source" }), + [string]$UpdateCache = $(if ($env:DOSH_UPDATE_CACHE) { $env:DOSH_UPDATE_CACHE } elseif ($env:LOCALAPPDATA) { Join-Path $env:LOCALAPPDATA "dosh\source" } else { Join-Path $HOME ".cache\dosh\source" }), [switch]$BinaryRequired = $($env:DOSH_BINARY_REQUIRED -and $env:DOSH_BINARY_REQUIRED -ne "0"), [switch]$ForceConfig ) diff --git a/tests/release_scripts.rs b/tests/release_scripts.rs index 339d696..0b22e7c 100644 --- a/tests/release_scripts.rs +++ b/tests/release_scripts.rs @@ -163,6 +163,9 @@ fn installers_refuse_prebuilts_without_checksums() { fn windows_installer_reuses_persistent_source_update_cache() { let ps1 = include_str!("../install.ps1"); assert!(ps1.contains("DOSH_UPDATE_CACHE")); + assert!(ps1.contains("elseif ($env:LOCALAPPDATA)")); + assert!(ps1.contains("Join-Path $env:LOCALAPPDATA \"dosh\\source\"")); + assert!(ps1.contains("Join-Path $HOME \".cache\\dosh\\source\"")); assert!(ps1.contains("Assert-NoRelativePathSegments($Path)")); assert!(ps1.contains("Assert-NoRelativePathSegments $Path")); assert!(ps1.contains("$segment -eq \".\" -or $segment -eq \"..\""));