bugfix: force overwrite, create fonts directory

This commit is contained in:
Baipyrus 2024-11-28 16:12:55 +01:00
parent 7c86d72ece
commit 406367b2eb

View File

@ -189,7 +189,7 @@ function InstallNerdFont
# Extract contents of zip archive
Write-Host "Extracting archive $source to $destination..." -ForegroundColor Cyan
Expand-Archive $source -DestinationPath $destination | Out-Null
Expand-Archive $source -DestinationPath $destination -Force | Out-Null
# Install extracted fonts
$fontFiles = Get-ChildItem -Path $destination -Include "*.ttf", "*.otf"
@ -213,6 +213,11 @@ function InstallFont
$destination = "$env:LOCALAPPDATA\Microsoft\Windows\Fonts\"
$regKey = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts"
# Create destination directory
if (-not (Test-Path $destination))
{ New-Item -ItemType Directory -Path $destination | Out-Null
}
# Get Glyph
$glyph = New-Object -TypeName Windows.Media.GlyphTypeface -ArgumentList $file.FullName