Skip to content

Commit 1bfd8bd

Browse files
authored
Simplify WinUtil Directory Creation in 'main.ps1' script by using C# 'CreateDirectory' Method which checks and creates the provided Directory Path (#2654)
1 parent 6ad31ed commit 1bfd8bd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

scripts/main.ps1

+1-4
Original file line numberDiff line numberDiff line change
@@ -450,17 +450,14 @@ $winutildir = @{}
450450

451451
# Set the path for the winutil directory
452452
$winutildir["path"] = "$env:LOCALAPPDATA\winutil\"
453-
if (-NOT (Test-Path -Path $winutildir["path"])) {
454-
New-Item -Path $winutildir["path"] -ItemType Directory
455-
}
453+
[System.IO.Directory]::CreateDirectory("$winutildir") | Out-Null
456454

457455
# Set the path for the logo and checkmark images
458456
$winutildir["logo.png"] = $winutildir["path"] + "cttlogo.png"
459457
$winutildir["logo.ico"] = $winutildir["path"] + "cttlogo.ico"
460458
if (-NOT (Test-Path -Path $winutildir["logo.png"])) {
461459
Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile $winutildir["logo.png"]
462460
}
463-
464461
if (-NOT (Test-Path -Path $winutildir["logo.ico"])) {
465462
ConvertTo-Icon -bitmapPath $winutildir["logo.png"] -iconPath $winutildir["logo.ico"]
466463
}

0 commit comments

Comments
 (0)