Skip to content
Snippets Groups Projects
Commit a878c6a4 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Be more conservative in Exit-IfDirMissing.

An exception would otherwise result in a silenced error as the output
would be discarded.
parent ea618b2b
No related branches found
No related tags found
No related merge requests found
......@@ -87,11 +87,20 @@ function Create-TrayAppStartupShortcut() {
function Exit-IfDirMissing([string]$DirName, [string]$Desc) {
if (Test-Path -PathType Container $DirName) {
Write-Verbose "Verified $($Desc) path: [$($DirName)]"
Return
try {
if (Test-Path -PathType Container $DirName) {
Write-Verbose "Verified $($Desc) path: [$($DirName)]"
Return
}
}
catch {
$exmsg = $($_.Exception.Message)
}
$msg = "Failed checking $($Desc) path [$($DirName)]"
if ($exmsg.Length -gt 0){
$msg += ":`n$($exmsg)"
}
$msg = "ERROR: can't find / access $($Desc) path: [$($DirName)]"
Log-Error $msg
Send-MailReport -Subject "path or permission error" -Body $msg
Exit
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment