Skip to content

Commit 8df4f3d

Browse files
committed
installer.ps1 fix
1 parent be0109f commit 8df4f3d

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

scripts/install.ps1

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ set -VersionTag to a tag that has the .zip, or add the .zip to the release manua
9292
return
9393
}
9494

95+
# Use .NET temp path (full path, no trailing separator quirks). Avoids Remove-Item -Recurse
96+
# mis-resolving 8.3 short paths under usernames with dots (e.g. lucia.poma → LUCIA~1.POM errors).
97+
$tempRoot = [System.IO.Path]::GetTempPath().TrimEnd([char[]]@('\', '/'))
9598
$work = $null
9699
try {
97-
$work = Join-Path $env:TEMP "dbs-annotator-install\$([guid]::NewGuid().ToString('n'))"
100+
$work = Join-Path $tempRoot "dbs-annotator-install\$([guid]::NewGuid().ToString('n'))"
98101
$zipFile = Join-Path $work "download.zip"
99102
$expand = Join-Path $work "e"
100103
New-Item -ItemType Directory -Path $work -Force -ErrorAction Stop | Out-Null
@@ -134,7 +137,20 @@ set -VersionTag to a tag that has the .zip, or add the .zip to the release manua
134137
}
135138
Write-Host "Done. Run: $($exe.FullName)"
136139
} finally {
137-
if ($work -and (Test-Path $work)) { Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue }
140+
if ($work -and (Test-Path -LiteralPath $work)) {
141+
try {
142+
[System.IO.Directory]::Delete($work, $true)
143+
} catch {
144+
try {
145+
Get-ChildItem -LiteralPath $work -Force -Recurse -ErrorAction SilentlyContinue |
146+
Sort-Object { $_.FullName.Length } -Descending |
147+
Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
148+
Remove-Item -LiteralPath $work -Force -Recurse -ErrorAction SilentlyContinue
149+
} catch {
150+
# Best-effort: install succeeded; stale temp folder is harmless
151+
}
152+
}
153+
}
138154
}
139155
}
140156

0 commit comments

Comments
 (0)