From 1bfd8bddcc42a43dfaa5a2d5100ef61c4ceaea86 Mon Sep 17 00:00:00 2001 From: "Mr.k" Date: Tue, 10 Sep 2024 04:13:32 +0300 Subject: [PATCH] Simplify WinUtil Directory Creation in 'main.ps1' script by using C# 'CreateDirectory' Method which checks and creates the provided Directory Path (#2654) --- scripts/main.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/main.ps1 b/scripts/main.ps1 index bcc209b2..6a998a1d 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -450,9 +450,7 @@ $winutildir = @{} # Set the path for the winutil directory $winutildir["path"] = "$env:LOCALAPPDATA\winutil\" -if (-NOT (Test-Path -Path $winutildir["path"])) { - New-Item -Path $winutildir["path"] -ItemType Directory -} +[System.IO.Directory]::CreateDirectory("$winutildir") | Out-Null # Set the path for the logo and checkmark images $winutildir["logo.png"] = $winutildir["path"] + "cttlogo.png" @@ -460,7 +458,6 @@ $winutildir["logo.ico"] = $winutildir["path"] + "cttlogo.ico" if (-NOT (Test-Path -Path $winutildir["logo.png"])) { Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile $winutildir["logo.png"] } - if (-NOT (Test-Path -Path $winutildir["logo.ico"])) { ConvertTo-Icon -bitmapPath $winutildir["logo.png"] -iconPath $winutildir["logo.ico"] }