From 59649a5ffa9ce573b1e08b2947a4338fb8d64968 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Tue, 27 Aug 2024 16:33:55 +0200 Subject: [PATCH] unzip and install nerd fonts --- install_windows.ps1 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/install_windows.ps1 b/install_windows.ps1 index d3946aa..9cac870 100644 --- a/install_windows.ps1 +++ b/install_windows.ps1 @@ -153,9 +153,38 @@ ProcessUrlFiles -sourceDir "$dotfilesRepo\nvim" -destinationDir "$env:LOCALAPPDA Write-Host "Setting up PowerShell profile..." -ForegroundColor Cyan CopyFileWithPrompt "$dotfilesRepo\PowerShell\Microsoft.PowerShell_profile.ps1" $psProfile +function UnzipAndInstall +{ + param ( + [string]$source, + [string]$path + ) + + # Create temporary directory for curl + $appname = $source.Split('\')[-1] + $tmpApp = "$env:TMP\$appname-config" + if (-not (Test-Path $tmpApp)) + { New-Item -ItemType Directory -Path $tmpApp | Out-Null + } + + # Find all .url files in the source directory + $urlFiles = Get-ChildItem -Path $source -Filter '*.url' + + foreach ($file in $urlFiles) + { + $fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name) + Write-Host "Extracting archive $tmpApp\$fileName.zip to $tmpApp\$fileName\..." -ForegroundColor Cyan + unzip -o "$tmpApp\$fileName.zip" -d "$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 + } +} + # Installing Nerd Fonts Write-Host "Installing Nerd Fonts..." -ForegroundColor Cyan ProcessUrlFiles -sourceDir "$dotfilesRepo\nerd-fonts" -fileExt ".zip" +UnzipAndInstall -source "$dotfilesRepo\nerd-fonts" -path "$env:TMP\nerd-fonts-config" # Final message Write-Host "Windows setup complete!" -ForegroundColor Green