Fix cd-temp.ps1

This commit is contained in:
Markus Fleschutz 2022-02-25 13:11:33 +01:00
parent 3618087c25
commit 447560ef34

View File

@ -13,16 +13,18 @@
#> #>
function GetTempDir { function GetTempDir {
if ($IsLinux) { return "/tmp" } if ("$env:TEMP" -ne "") { return "$env:TEMP" }
return "$env:TEMP" if ("$env:TMP" -ne "") { return "$env:TMP" }
if ($IsLinux) { return "/tmp" }
return "C:\Temp"
} }
try { try {
$Path = resolve-path GetTempDir $Path = GetTempDir
if (-not(test-path "$Path" -pathType container)) { if (-not(Test-Path "$Path" -pathType container)) {
throw "Temporary folder at 📂$Path doesn't exist (yet)" throw "Temporary folder at 📂$Path doesn't exist (yet)"
} }
set-location "$Path" Set-Location "$Path"
"📂$Path" "📂$Path"
exit 0 # success exit 0 # success
} catch { } catch {