1
0
Fork 0

add script to install fonts

master
Ducky 2021-12-13 06:52:25 +00:00
parent 381d888aa9
commit 8758ba45c5
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
$fontsPath = [System.IO.Path]::Combine($PSScriptRoot, "..", "assets", "fonts")
$fontFiles = Get-ChildItem -Recurse $fontsPath | ForEach-Object { if ($_.Extension -eq ".ttf") { $_ } }
function Install-FontFiles {
param(
[System.IO.FileInfo[]]$InFonts,
[string]$OutFontsPath
)
foreach ($fontFile in $InFonts) {
Write-Output "Installing $($fontFile.BaseName)..."
$installPath = ([System.IO.Path]::Combine($OutFontsPath, $fontFile.Name))
if (-not(Test-Path -Path $installPath)) {
Copy-Item -Force $fontFile $installPath
}
}
}
if (
($PSVersionTable.PSVersion.Major -eq 5 -and $PSVersionTable.PSVersion.Minor -gt 0) -or
$IsWindows
) {
Install-FontFiles -InFonts $fontFiles -OutFontsPath ([System.IO.Path]::Combine("C:", "Windows", "Fonts"))
}
elseif ($IsLinux) {
Install-FontFiles -InFonts $fontFiles -OutFontsPath ([System.IO.Path]::Combine("usr", "local", "share", "fonts"))
}
else {
Write-Error "Platform not supported."
exit
}