From 593d0e5ee8033e03ece1d6c845145a548224cf5a Mon Sep 17 00:00:00 2001 From: Boof2015 <75185879+Boof2015@users.noreply.github.com> Date: Tue, 2 Jun 2026 08:11:54 -0400 Subject: [PATCH] update windows installer --- package.json | 3 ++ resources/installer/windows-vst3.nsh | 67 +++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 863338b..6affe64 100644 --- a/package.json +++ b/package.json @@ -118,6 +118,9 @@ "icon": "resources/icon.ico" }, "nsis": { + "oneClick": false, + "perMachine": true, + "allowToChangeInstallationDirectory": true, "include": "resources/installer/windows-vst3.nsh" }, "linux": { diff --git a/resources/installer/windows-vst3.nsh b/resources/installer/windows-vst3.nsh index 19aa96d..544c671 100644 --- a/resources/installer/windows-vst3.nsh +++ b/resources/installer/windows-vst3.nsh @@ -1,20 +1,67 @@ ; Custom NSIS include for electron-builder. ; -; After the main Prism app install finishes, copy the bundled VST3 plugin -; bundles out of $INSTDIR\resources\plugins\VST3\ into the system VST3 folder -; (C:\Program Files\Common Files\VST3\) so DAWs find them. On uninstall, remove -; them. The main NSIS installer already requested admin elevation (it has to, -; for Program Files), so writes to CommonFiles64 succeed without a second UAC. +; Wizard installer (oneClick=false, perMachine=true) with an optional VST3 +; install step. After the directory page, we add a custom page with a checkbox: +; +; [x] Install Prism VST3 plugins (recommended) +; +; If checked, customInstall xcopies the bundled .vst3 bundles from +; $INSTDIR\resources\plugins\VST3\ into $COMMONFILES64\VST3\ — the standard +; system VST3 folder. The whole installer already runs elevated (perMachine=true +; → UAC prompt at launch), so writes to Common Files succeed without a second +; elevation. On uninstall, the bundles are removed unconditionally (harmless if +; the user opted out at install time). + +!include "nsDialogs.nsh" +!include "LogicLib.nsh" + +Var PRISM_VST_CHECKBOX +Var PRISM_VST_STATE + +; Hook called from electron-builder's assistedInstaller.nsh between the directory +; page and the install-files page. Adds our custom checkbox page. +!macro customPageAfterChangeDir + Page custom prismVstOptionsPage prismVstOptionsPageLeave +!macroend + +Function prismVstOptionsPage + !insertmacro MUI_HEADER_TEXT "VST3 Plugins" "Choose whether to install the Prism scope plugins." + + nsDialogs::Create 1018 + Pop $0 + ${If} $0 == error + Abort + ${EndIf} + + ${NSD_CreateCheckBox} 0 0u 100% 12u "Install Prism VST3 plugins (recommended)" + Pop $PRISM_VST_CHECKBOX + ${NSD_Check} $PRISM_VST_CHECKBOX + + ${NSD_CreateLabel} 0 22u 100% 80u "Installs the seven Prism scope plugins (Spectrum, Oscilloscope, Vectorscope, Spectrogram, VU Meter, Loudness Meter, Waveform) to:$\r$\n$\r$\n $COMMONFILES64\VST3$\r$\n$\r$\nDAWs (FL Studio, Ableton, Logic, Reaper, etc.) will find them on the next plugin rescan.$\r$\n$\r$\nUncheck to install only the Prism desktop app. You can re-run this installer at any time to add the plugins later." + Pop $0 + + nsDialogs::Show +FunctionEnd + +Function prismVstOptionsPageLeave + ${NSD_GetState} $PRISM_VST_CHECKBOX $PRISM_VST_STATE +FunctionEnd !macro customInstall - ; Ensure the destination exists; xcopy creates trees but not the leaf root. - CreateDirectory "$COMMONFILES64\VST3" - ; xcopy /E recurse, /I treat dest as dir, /Y overwrite without prompt. - ; The trailing "\*" + "/E" copies each *.vst3 bundle subfolder verbatim. - nsExec::ExecToLog 'cmd.exe /c xcopy /E /I /Y "$INSTDIR\resources\plugins\VST3\*" "$COMMONFILES64\VST3\"' + ${If} $PRISM_VST_STATE == ${BST_CHECKED} + DetailPrint "Installing Prism VST3 plugins to $COMMONFILES64\VST3" + CreateDirectory "$COMMONFILES64\VST3" + ; xcopy /E recurse, /I treat dest as dir, /Y overwrite without prompt. + ; The trailing "\*" + "/E" copies each *.vst3 bundle subfolder verbatim. + nsExec::ExecToLog 'cmd.exe /c xcopy /E /I /Y "$INSTDIR\resources\plugins\VST3\*" "$COMMONFILES64\VST3\"' + ${Else} + DetailPrint "Prism VST3 plugins: skipped (opted out)." + ${EndIf} !macroend !macro customUnInstall + ; Always attempt removal — harmless RMDir if the bundle isn't there (user opted + ; out at install or removed manually). RMDir /r "$COMMONFILES64\VST3\Prism Spectrum.vst3" RMDir /r "$COMMONFILES64\VST3\Prism Oscilloscope.vst3" RMDir /r "$COMMONFILES64\VST3\Prism VU Meter.vst3"