@@ -118,9 +118,36 @@ jobs:
118118 if : matrix.build_type == 'msvc'
119119 uses : lukka/get-cmake@9e07ecdcee1b12e5037e42f410b67f03e2f626e1 # v4.2.1
120120
121- - name : Install NSIS (Windows)
121+ - name : Install NSIS with Large Strings (Windows)
122122 if : matrix.build_type == 'msvc'
123- run : choco install nsis -y
123+ run : |
124+ # Install NSIS with 8k string support (8192 byte buffer instead of default 1024)
125+ # This fixes "Path too long" errors when modifying PATH on systems with long PATH variables
126+ # See: https://github.com/Sapd/HeadsetControl/issues/462
127+ $nsisVersion = "3.10"
128+ $nsisPath = "C:\NSIS"
129+
130+ # 1. Download and extract base NSIS
131+ Invoke-WebRequest -Uri "https://sourceforge.net/projects/nsis/files/NSIS%203/$nsisVersion/nsis-$nsisVersion.zip/download" -OutFile nsis.zip -UserAgent "Wget"
132+ Expand-Archive nsis.zip -DestinationPath nsis-base
133+ Move-Item "nsis-base\nsis-$nsisVersion" $nsisPath
134+
135+ # 2. Layer large strings build on top
136+ Invoke-WebRequest -Uri "https://sourceforge.net/projects/nsis/files/NSIS%203/$nsisVersion/nsis-$nsisVersion-strlen_8192.zip/download" -OutFile nsis-large.zip -UserAgent "Wget"
137+ Expand-Archive nsis-large.zip -DestinationPath nsis-large
138+ Copy-Item "nsis-large\*" $nsisPath -Recurse -Force
139+
140+ # Add to PATH for subsequent steps
141+ echo $nsisPath | Out-File -FilePath $env:GITHUB_PATH -Append
142+
143+ # Verify installation
144+ if (Test-Path "$nsisPath\makensis.exe") {
145+ Write-Host "NSIS installed successfully"
146+ & "$nsisPath\makensis.exe" /VERSION
147+ } else {
148+ Write-Error "makensis.exe not found at $nsisPath"
149+ exit 1
150+ }
124151
125152 # =========== Unix Setup ===========
126153 - name : Setup CMake and Ninja (Unix)
@@ -216,7 +243,7 @@ jobs:
216243 if : matrix.build_type == 'msvc'
217244 run : |
218245 cd build-msvc
219- cpack -G NSIS
246+ cpack -G NSIS -D CPACK_NSIS_EXECUTABLE="C:/NSIS/makensis.exe"
220247 $installer = Get-ChildItem -Filter "headsetcontrol-*.exe" | Where-Object { $_.Name -ne "headsetcontrol.exe" } | Select-Object -First 1
221248 if ($installer) {
222249 Rename-Item -Path $installer.FullName -NewName "headsetcontrol-${{ matrix.os_name }}-${{ matrix.architecture }}-setup.exe"
0 commit comments