Skip to content

Commit e6bc53c

Browse files
fix: honor isolated PowerShell home (#73)
Follow-up to #101 and #102; fixes the Windows installer root cause for #73.
1 parent 63be264 commit e6bc53c

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎install.ps1‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ if ($ShowHelp) {
1818
$releaseVersion = "2.0.1"
1919
$releaseTag = "v$releaseVersion"
2020
$releaseWheelUrl = "https://github.com/EvanProgramming/OpenKyrozen/releases/download/$releaseTag/openkyrozen-$releaseVersion-py3-none-any.whl"
21+
$homeDirectory = if ($env:HOME) { $env:HOME } else { $env:USERPROFILE }
2122

2223
Write-Output ""
2324
Write-Output " ____ ____ _____ _ _ ____ _____ _ _ ____ _ _ "
@@ -33,7 +34,7 @@ if ($architecture -notin @("X64", "Arm64")) {
3334
Fail "Unsupported Windows architecture: $architecture"
3435
}
3536

36-
$stateDir = Join-Path $HOME ".kyrozen"
37+
$stateDir = Join-Path $homeDirectory ".kyrozen"
3738
try {
3839
New-Item -ItemType Directory -Force -Path (Join-Path $stateDir "workspace") | Out-Null
3940
New-Item -ItemType Directory -Force -Path (Join-Path $stateDir "v2") | Out-Null
@@ -47,8 +48,8 @@ try {
4748
Fail "GitHub release asset is unavailable: $releaseTag"
4849
}
4950

50-
$localBin = Join-Path $HOME ".local\bin"
51-
$cargoBin = Join-Path $HOME ".cargo\bin"
51+
$localBin = Join-Path $homeDirectory ".local\bin"
52+
$cargoBin = Join-Path $homeDirectory ".cargo\bin"
5253
$env:Path = "$localBin;$cargoBin;$env:Path"
5354

5455
$uvCommand = Get-Command uv -ErrorAction SilentlyContinue

‎tests/test_distribution.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def test_powershell_installer_is_static_safe_and_parses_when_available(self):
8989
text = installer.read_text(encoding="utf-8")
9090
self.assertIn('[Alias("Help")]', text)
9191
self.assertIn("$ShowHelp", text)
92+
self.assertIn("$homeDirectory = if ($env:HOME)", text)
93+
self.assertNotIn('Join-Path $HOME ".kyrozen"', text)
9294
self.assertIn("[Environment]::GetEnvironmentVariable(\"Path\", \"User\")", text)
9395
self.assertIn("SetEnvironmentVariable(\"Path\"", text)
9496
self.assertIn("tool install --python", text)

0 commit comments

Comments
 (0)