Update the scripts

This commit is contained in:
Markus Fleschutz 2021-12-10 11:51:51 +01:00
parent e8b0875b2a
commit 41e06dd2f8
3 changed files with 13 additions and 7 deletions

View File

@ -16,8 +16,10 @@
param([string]$text = "")
function GetTempDir {
if ("$env:TEMP" -ne "") { return "$env:TEMP" }
if ("$env:TMP" -ne "") { return "$env:TMP" }
if ($IsLinux) { return "/tmp" }
return "$env:TEMP"
return "C:\Temp"
}
try {

View File

@ -12,16 +12,18 @@
#>
function GetTempDir {
if ("$env:TEMP" -ne "") { return "$env:TEMP" }
if ("$env:TMP" -ne "") { return "$env:TMP" }
if ($IsLinux) { return "/tmp" }
return "$env:TEMP"
return "C:\Temp"
}
try {
$TargetDir = resolve-path GetTempDir
if (-not(test-path "$TargetDir" -pathType container)) {
throw "Temporary folder at 📂$TargetDir doesn't exist (yet)"
$Path = GetTempDir
if (-not(test-path "$Path" -pathType container)) {
throw "Temporary folder at 📂$Path doesn't exist (yet)"
}
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
& "$PSScriptRoot/open-file-explorer.ps1" "$Path"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"

View File

@ -12,8 +12,10 @@
#>
function GetTempDir {
if ("$env:TEMP" -ne "") { return "$env:TEMP" }
if ("$env:TMP" -ne "") { return "$env:TMP" }
if ($IsLinux) { return "/tmp" }
return "$env:TEMP"
return "C:\Temp"
}
if (test-path "$(GetTempDir)/last_reply_given.txt" -pathType leaf) {