diff --git a/src/windows_installer/supertuxkart.nsi b/src/windows_installer/supertuxkart.nsi index 7305510b8..7ed138747 100644 --- a/src/windows_installer/supertuxkart.nsi +++ b/src/windows_installer/supertuxkart.nsi @@ -56,12 +56,29 @@ !define MUI_ABORTWARNING +;-------------------------------- +Function validate_dir + IfFileExists $INSTDIR\data\*.* 0 return + IfFileExists $INSTDIR\Uninstall.exe 0 dont_uninstall + MessageBox MB_YESNO "You can't install SuperTuxKart 0.8 in an existing directory. Do you wish to run the uninstaller in $INSTDIR?" IDNO dont_uninstall + ; -?=$INSTDIR makes sure that this installer waits for the uninstaller + ; to finish. The uninstaller (and directory) are not removed, but the + ; uninstaller will be overwritten by our installer anyway. + ExecWait '"$INSTDIR\Uninstall.exe" _?=$INSTDIR' + goto return + dont_uninstall: + MessageBox MB_OK "You can't install SuperTuxKart 0.8 in an existing directory. Please select a new directory." + abort + return: +FunctionEnd ;-------------------------------- ;Pages ;Installer pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "SuperTuxKart\License.txt" + + !define MUI_PAGE_CUSTOMFUNCTION_LEAVE validate_dir !insertmacro MUI_PAGE_DIRECTORY ;Start Menu Folder Page Configuration @@ -92,7 +109,7 @@ Section "Main Section" SecMain SetOutPath "$INSTDIR" - ;Adds all the tux kart files + ; Adds all SuperTuxKart files File /r supertuxkart\*.* ;Store installation folder