Browse Source

Re-enable NSIS installer. Make installer safer by preventing user from

installing to folder that already exists.
tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
38651ce195
2 changed files with 22 additions and 11 deletions
  1. +2
    -2
      Makefile
  2. +20
    -9
      installer.nsi

+ 2
- 2
Makefile View File

@@ -203,8 +203,8 @@ ifdef ARCH_WIN
cd dist && zip -q -9 -r $(DIST_NAME).zip Rack cd dist && zip -q -9 -r $(DIST_NAME).zip Rack
# Make NSIS installer # Make NSIS installer
# pacman -S mingw-w64-x86_64-nsis # pacman -S mingw-w64-x86_64-nsis
# makensis -DVERSION=$(VERSION) installer.nsi
# mv installer.exe dist/$(DIST_NAME).exe
makensis -DVERSION=$(VERSION) installer.nsi
mv installer.exe dist/$(DIST_NAME).exe
endif endif


# Build Rack SDK # Build Rack SDK


+ 20
- 9
installer.nsi View File

@@ -1,8 +1,9 @@
!include "MUI2.nsh" !include "MUI2.nsh"


Name "VCV Rack ${VERSION}"
Name "VCV Rack v${VERSION}"
OutFile "installer.exe" OutFile "installer.exe"
SetCompressor /solid "lzma" SetCompressor /solid "lzma"
SetCompressorDictSize 8
CRCCheck On CRCCheck On


; Default installation folder ; Default installation folder
@@ -15,7 +16,7 @@ InstallDirRegKey HKLM "Software\VCV\Rack" ""
RequestExecutionLevel admin RequestExecutionLevel admin




; MUI pages
; MUI installer pages


!define MUI_ICON "icon.ico" !define MUI_ICON "icon.ico"
!define MUI_HEADERIMAGE !define MUI_HEADERIMAGE
@@ -24,8 +25,18 @@ RequestExecutionLevel admin
;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" ; 164x314 ;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" ; 164x314


!define MUI_COMPONENTSPAGE_NODESC !define MUI_COMPONENTSPAGE_NODESC
!insertmacro MUI_PAGE_COMPONENTS

; !insertmacro MUI_PAGE_COMPONENTS

; Prevent user from choosing an installation directory that already exists, such as C:\Program Files.
; This is necessary because the uninstaller removes the installation directory, which is dangerous for directories that existed before Rack was installed.
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE directoryLeave
Function directoryLeave
IfFileExists "$INSTDIR" directoryExists directoryNotExists
directoryExists:
MessageBox MB_OK|MB_ICONSTOP "Cannot install to $INSTDIR. Folder already exists."
Abort
directoryNotExists:
FunctionEnd
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY


!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
@@ -34,8 +45,9 @@ RequestExecutionLevel admin
!define MUI_FINISHPAGE_RUN_TEXT "Launch VCV Rack" !define MUI_FINISHPAGE_RUN_TEXT "Launch VCV Rack"
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH


!insertmacro MUI_UNPAGE_CONFIRM
; MUI uninstaller pages


!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_INSTFILES


!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "English"
@@ -80,10 +92,9 @@ SectionEnd




Section "Uninstall" Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
Delete "$INSTDIR\*"
RMDir /r "$INSTDIR\res"
RMDir "$INSTDIR"
; directoryLeave above ensures that INSTDIR is safe to remove.
RMDir /r "$INSTDIR"
; Attempt to remove C:\Program Files\VCV if empty
RMDir "$INSTDIR\.." RMDir "$INSTDIR\.."


Delete "$SMPROGRAMS\VCV Rack.lnk" Delete "$SMPROGRAMS\VCV Rack.lnk"


Loading…
Cancel
Save