Simplify WinUtil Directory Creation in 'main.ps1' script by using C# 'CreateDirectory' Method which checks and creates the provided Directory Path (#2654)

This commit is contained in:
Mr.k 2024-09-10 04:13:32 +03:00 committed by GitHub
parent 6ad31edef1
commit 1bfd8bddcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -450,9 +450,7 @@ $winutildir = @{}
# Set the path for the winutil directory # Set the path for the winutil directory
$winutildir["path"] = "$env:LOCALAPPDATA\winutil\" $winutildir["path"] = "$env:LOCALAPPDATA\winutil\"
if (-NOT (Test-Path -Path $winutildir["path"])) { [System.IO.Directory]::CreateDirectory("$winutildir") | Out-Null
New-Item -Path $winutildir["path"] -ItemType Directory
}
# Set the path for the logo and checkmark images # Set the path for the logo and checkmark images
$winutildir["logo.png"] = $winutildir["path"] + "cttlogo.png" $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"])) { if (-NOT (Test-Path -Path $winutildir["logo.png"])) {
Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile $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"])) { if (-NOT (Test-Path -Path $winutildir["logo.ico"])) {
ConvertTo-Icon -bitmapPath $winutildir["logo.png"] -iconPath $winutildir["logo.ico"] ConvertTo-Icon -bitmapPath $winutildir["logo.png"] -iconPath $winutildir["logo.ico"]
} }