From 107b83ced49475c2a6f1fc36893934f957ec323d Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Mon, 25 Nov 2024 14:34:36 +0100 Subject: [PATCH] bugfix: create local user fonts directory if not exists --- util/windows.psm1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/windows.psm1 b/util/windows.psm1 index 443b8a3..ab919b0 100644 --- a/util/windows.psm1 +++ b/util/windows.psm1 @@ -168,6 +168,11 @@ function UnzipAndInstall { New-Item -ItemType Directory -Path $tmpApp | Out-Null } + $destination = "$env:LOCALAPPDATA\Microsoft\Windows\Fonts\" + if (-not (Test-Path $destination)) + { New-Item -ItemType Directory -Path $destination | Out-Null + } + # Find all .url files in the source directory $urlFiles = Get-ChildItem -Path $source -Filter '*.url' @@ -178,6 +183,6 @@ function UnzipAndInstall Expand-Archive "$tmpApp\$fileName.zip" -DestinationPath "$tmpApp\$fileName" | Out-Null Write-Host "Installing fonts from $tmpApp\$fileName\ for current user..." -ForegroundColor Cyan - Copy-Item -Path "$tmpApp\$fileName\*" -Destination "$env:LOCALAPPDATA\Microsoft\Windows\Fonts\" -Force -ErrorAction SilentlyContinue + Copy-Item -Path "$tmpApp\$fileName\*" -Destination $destination -Force -ErrorAction SilentlyContinue } }