Skip to content

Commit

Permalink
feat(nsis): display required disk space
Browse files Browse the repository at this point in the history
Fixed warning 6000 unknown variable/constant "{SYSTYPE_PTR}" detected

#7487
  • Loading branch information
Nikolay Velizhanin authored and Nikolay Velizhanin committed Apr 17, 2023
1 parent 1b9b529 commit d1aecea
Showing 1 changed file with 46 additions and 42 deletions.
88 changes: 46 additions & 42 deletions packages/app-builder-lib/templates/nsis/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -39,48 +39,8 @@ Var oldMenuDirectory
!insertmacro customHeader
!endif

!ifndef BUILD_UNINSTALLER
!include "installUtil.nsh"
!endif

Section "install" INSTALL_SECTION_ID
!ifndef BUILD_UNINSTALLER
# If we're running a silent upgrade of a per-machine installation, elevate so extracting the new app will succeed.
# For a non-silent install, the elevation will be triggered when the install mode is selected in the UI,
# but that won't be executed when silent.
!ifndef INSTALL_MODE_PER_ALL_USERS
!ifndef ONE_CLICK
${if} $hasPerMachineInstallation == "1" # set in onInit by initMultiUser
${andIf} ${Silent}
${ifNot} ${UAC_IsAdmin}
ShowWindow $HWNDPARENT ${SW_HIDE}
!insertmacro UAC_RunElevated
${Switch} $0
${Case} 0
${Break}
${Case} 1223 ;user aborted
${Break}
${Default}
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate, error $0"
${Break}
${EndSwitch}
Quit
${else}
!insertmacro setInstallModePerAllUsers
${endIf}
${endIf}
!endif
!endif
!include "installSection.nsh"
!endif
SectionEnd

!ifdef BUILD_UNINSTALLER
!include "uninstaller.nsh"
!endif

Function .onInit
!insertmacro setSpaceRequired ${INSTALL_SECTION_ID}
Call setInstallSectionSpaceRequired

SetOutPath $INSTDIR
${LogSet} on
Expand Down Expand Up @@ -118,4 +78,48 @@ Function .onInit
!insertmacro addLicenseFiles
!endif
!endif
FunctionEnd
FunctionEnd

!ifndef BUILD_UNINSTALLER
!include "installUtil.nsh"
!endif

Section "install" INSTALL_SECTION_ID
!ifndef BUILD_UNINSTALLER
# If we're running a silent upgrade of a per-machine installation, elevate so extracting the new app will succeed.
# For a non-silent install, the elevation will be triggered when the install mode is selected in the UI,
# but that won't be executed when silent.
!ifndef INSTALL_MODE_PER_ALL_USERS
!ifndef ONE_CLICK
${if} $hasPerMachineInstallation == "1" # set in onInit by initMultiUser
${andIf} ${Silent}
${ifNot} ${UAC_IsAdmin}
ShowWindow $HWNDPARENT ${SW_HIDE}
!insertmacro UAC_RunElevated
${Switch} $0
${Case} 0
${Break}
${Case} 1223 ;user aborted
${Break}
${Default}
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate, error $0"
${Break}
${EndSwitch}
Quit
${else}
!insertmacro setInstallModePerAllUsers
${endIf}
${endIf}
!endif
!endif
!include "installSection.nsh"
!endif
SectionEnd

Function setInstallSectionSpaceRequired
!insertmacro setSpaceRequired ${INSTALL_SECTION_ID}
FunctionEnd

!ifdef BUILD_UNINSTALLER
!include "uninstaller.nsh"
!endif

0 comments on commit d1aecea

Please sign in to comment.