Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions windows/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ LangString OLD_WRONG_VER_FOUND ${LANG_ENGLISH} \

LangString OLD_WRONG_VER_FOUND_CONFIRM ${LANG_ENGLISH} \
"If you continue without removing it, your installation might be broken! Are you sure you don't want to remove the old version?"
LangString OLD_WRONG_VER_REMOVE_FAILED ${LANG_ENGLISH} \
"FATAL: THE OLD UNINSTALLER FAILED. Once you click on OK the old version will remain on your PC and we will try to install the new version too. You can also press cancel and try to remove it on your own."
LangString OLD_VER_REMOVE_FAILED ${LANG_ENGLISH} \
"FATAL: THE UNINSTALLER FAILED. Once you click on OK the old version will remain on your PC and we will try to install the new version too. You can also press cancel and try to remove it on your own."
; Abort the installer/uninstaller if Jamulus is running
!macro _AbortOnRunningApp

Expand All @@ -108,14 +108,29 @@ LangString OLD_WRONG_VER_REMOVE_FAILED ${LANG_ENGLISH} \
!define prefix "${DEPLOY_PATH}\${buildArch}"
!tempfile files

; Find target folders
; Find target folders (Probably here's an issue with quoting. If ${prefix} contains spaces, the installer folders aren't created in the right way.)
!system 'cmd.exe /v /c "for /f "usebackq" %d in (`dir /b /s /ad "${prefix}"`) do \
@(set "_d=%d" && echo CreateDirectory "$INSTDIR\!_d:${prefix}\=!" >> "${files}")"'

; Find target files
!system 'cmd.exe /v /c "for /r "${prefix}" %f in (*.*) do \
@(set "_f=%f" && echo File "/oname=$INSTDIR\!_f:${prefix}\=!" "!_f!" >> "${files}")"'

InitPluginsDir ; see https://stackoverflow.com/questions/24595887/waiting-for-nsis-uninstaller-to-finish-in-nsis-installer-either-fails-or-the-uni
IfFileExists "$INSTDIR\${UNINSTALL_EXE}" old_install_found continueinstall

old_install_found:
CreateDirectory "$pluginsdir\unold" ; Make sure plugins do not conflict with a old uninstaller
CopyFiles /SILENT /FILESONLY "$INSTDIR\${UNINSTALL_EXE}" "$pluginsdir\unold"
ExecWait '"$pluginsdir\unold\${UNINSTALL_EXE}" /S _?=$INSTDIR' $0

${IfNot} $0 == 0
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(OLD_VER_REMOVE_FAILED)" /sd IDCANCEL IDOK continueinstall
Abort
${EndIf}

continueinstall:

; Install folders and files
CreateDirectory "$INSTDIR"
!include "${files}"
Expand Down Expand Up @@ -154,7 +169,6 @@ LangString OLD_WRONG_VER_REMOVE_FAILED ${LANG_ENGLISH} \
SectionGroup "InstallGroup"

Section "Install" Install_x86_64

; Install the main application
!insertmacro InstallApplication x86_64
!insertmacro SetupShortcuts
Expand Down Expand Up @@ -204,7 +218,7 @@ Function .onInit
removeold:
ExecWait "$PROGRAMFILES32\Jamulus\Uninstall.exe" $0
${IfNot} $0 == 0
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(OLD_WRONG_VER_REMOVE_FAILED)" /sd IDCANCEL IDOK continueinstall
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(OLD_VER_REMOVE_FAILED)" /sd IDCANCEL IDOK continueinstall
goto quit
${EndIf}
goto continueinstall
Expand Down