diff --git a/installer/mc2_installer.nsi b/installer/mc2_installer.nsi index e527b3778..8e873bbd5 100644 --- a/installer/mc2_installer.nsi +++ b/installer/mc2_installer.nsi @@ -20,15 +20,19 @@ Name "${PROJECT_NAME} ${SUB_NAME}" ShowInstDetails show ;show/hide +Var RemoveOldDatabases + !include "LanguageStrings.nsh" !insertmacro MUI_LANGUAGE "English" InstallDir "$PROGRAMFILES\${INSTALL_DIR}" InstallDirRegKey HKCU "Software\${INSTALL_DIR}" "" +; Installation pages order !insertmacro MUI_PAGE_LICENSE "..\LICENSE.txt" !insertmacro MUI_PAGE_DIRECTORY ;!insertmacro MUI_PAGE_COMPONENTS +Page custom RemoveOldFilesPage RemoveOldFilesLeave ;Custom page !insertmacro MUI_PAGE_INSTFILES @@ -47,11 +51,18 @@ Section "mC2installation" main File /r "..\bin\release\resources" SetOutPath "$INSTDIR\plugins" + Delete "*.dll" File /r "..\bin\release\plugins\*.dll" SetAutoClose false + IntCmpU $RemoveOldDatabases 0 DoNotRemoveDBFiles + ; Remove the app data + RMDir /r $APPDATA\mC2 + DoNotRemoveDBFiles: + + CreateDirectory "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}" CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\${PROJECT_NAME}.lnk" "$INSTDIR\mC2.exe" CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\musikServer.lnk" "$INSTDIR\musikServer.exe" @@ -72,5 +83,15 @@ Section Uninstall SectionEnd Function .onInit + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "remove_old_db.ini" FunctionEnd +Function RemoveOldFilesPage + !insertmacro MUI_HEADER_TEXT "mC2 installation" "Removing old database files" + !insertmacro MUI_INSTALLOPTIONS_WRITE "remove_old_db.ini" "Field 2" "Text" "Remove old mC2 databases in $APPDATA\mC2" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "remove_old_db.ini" +FunctionEnd + +Function RemoveOldFilesLeave + !insertmacro MUI_INSTALLOPTIONS_READ $RemoveOldDatabases "remove_old_db.ini" "Field 2" "State" +FunctionEnd diff --git a/installer/remove_old_db.ini b/installer/remove_old_db.ini new file mode 100644 index 000000000..86c684e93 --- /dev/null +++ b/installer/remove_old_db.ini @@ -0,0 +1,29 @@ +; Ini file generated by the HM NIS Edit IO designer. +[Settings] +NumFields=3 + +[Field 1] +Type=Groupbox +Text=Remove old files +Left=10 +Right=258 +Top=7 +Bottom=83 + +[Field 2] +Type=Checkbox +Text=Remove old mC2 databases +Left=29 +Right=242 +Top=52 +Bottom=83 +State=1 + +[Field 3] +Type=Label +Text=If you have run an old version of mC2, you need to remove the old databases since they are incompatible with the latest version of mC2. +Left=22 +Right=248 +Top=23 +Bottom=52 +