2008-05-12 06:02:14 +00:00
|
|
|
SetCompressor /SOLID lzma
|
|
|
|
|
|
|
|
!include "MUI.nsh"
|
2008-12-09 12:38:04 +00:00
|
|
|
!include "FileFunc.nsh"
|
|
|
|
!insertmacro DirState
|
2008-05-12 06:02:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
!define TRUE 1
|
|
|
|
!define FALSE 0
|
|
|
|
|
|
|
|
!define MUI_BGCOLOR "FFFFFF"
|
|
|
|
|
|
|
|
!define PROJECT_NAME "musikCube 2"
|
2008-09-03 12:53:42 +00:00
|
|
|
!define SUB_NAME "developers milestone 2"
|
|
|
|
!define INSTALLER_NAME "mC2dm2"
|
2008-05-12 06:02:14 +00:00
|
|
|
!define INSTALL_DIR "musikCube 2"
|
|
|
|
|
|
|
|
;----------------------------------------------------------------
|
2008-12-09 12:38:04 +00:00
|
|
|
!define MC2_DB_DIR "$APPDATA\mC2"
|
|
|
|
|
2008-10-07 12:37:10 +00:00
|
|
|
OutFile ".\${INSTALLER_NAME}.exe"
|
2008-05-12 06:02:14 +00:00
|
|
|
|
|
|
|
Name "${PROJECT_NAME} ${SUB_NAME}"
|
|
|
|
|
|
|
|
ShowInstDetails show ;show/hide
|
|
|
|
|
2008-11-03 10:35:46 +00:00
|
|
|
Var RemoveOldDatabases
|
|
|
|
|
2008-05-17 18:14:10 +00:00
|
|
|
!include "LanguageStrings.nsh"
|
2008-05-12 06:02:14 +00:00
|
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
|
|
|
|
|
|
InstallDir "$PROGRAMFILES\${INSTALL_DIR}"
|
|
|
|
InstallDirRegKey HKCU "Software\${INSTALL_DIR}" ""
|
|
|
|
|
2008-11-03 10:35:46 +00:00
|
|
|
; Installation pages order
|
2008-05-17 18:14:10 +00:00
|
|
|
!insertmacro MUI_PAGE_LICENSE "..\LICENSE.txt"
|
2008-05-12 06:02:14 +00:00
|
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
2008-11-03 10:35:46 +00:00
|
|
|
Page custom RemoveOldFilesPage RemoveOldFilesLeave ;Custom page
|
2008-12-09 12:38:04 +00:00
|
|
|
;!insertmacro MUI_PAGE_COMPONENTS
|
2008-05-12 06:02:14 +00:00
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
|
|
|
|
|
|
|
|
Section "mC2installation" main
|
|
|
|
|
|
|
|
SectionIn RO
|
|
|
|
|
|
|
|
SetShellVarContext current
|
|
|
|
|
|
|
|
SetOverwrite on
|
|
|
|
|
|
|
|
SetOutPath "$INSTDIR"
|
|
|
|
File /r "..\bin\release\mC2.exe"
|
2008-09-03 12:53:42 +00:00
|
|
|
File /r "..\bin\release\musikServer.exe"
|
2008-05-17 18:14:10 +00:00
|
|
|
File /r "..\LICENSE.txt"
|
2008-10-07 12:37:10 +00:00
|
|
|
File /r "..\bin\release\resources"
|
2008-05-12 06:02:14 +00:00
|
|
|
|
|
|
|
SetOutPath "$INSTDIR\plugins"
|
2008-11-03 10:35:46 +00:00
|
|
|
Delete "*.dll"
|
2008-05-12 06:02:14 +00:00
|
|
|
File /r "..\bin\release\plugins\*.dll"
|
|
|
|
|
|
|
|
SetAutoClose false
|
|
|
|
|
|
|
|
|
2008-11-03 10:35:46 +00:00
|
|
|
IntCmpU $RemoveOldDatabases 0 DoNotRemoveDBFiles
|
|
|
|
; Remove the app data
|
2008-12-09 12:38:04 +00:00
|
|
|
RMDir /r "${MC2_DB_DIR}"
|
2008-11-03 10:35:46 +00:00
|
|
|
DoNotRemoveDBFiles:
|
|
|
|
|
|
|
|
|
2008-05-12 06:02:14 +00:00
|
|
|
CreateDirectory "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}"
|
|
|
|
CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\${PROJECT_NAME}.lnk" "$INSTDIR\mC2.exe"
|
2008-09-03 12:53:42 +00:00
|
|
|
CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\musikServer.lnk" "$INSTDIR\musikServer.exe"
|
2008-05-12 06:02:14 +00:00
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section -Post
|
|
|
|
WriteRegStr HKCU "Software\${INSTALL_DIR}" "" $INSTDIR
|
|
|
|
WriteUninstaller "$INSTDIR\uninst.exe"
|
|
|
|
CreateDirectory "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}"
|
|
|
|
CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section Uninstall
|
|
|
|
SetShellVarContext current
|
|
|
|
RMDir /r "$INSTDIR"
|
|
|
|
RMDir /r "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}"
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Function .onInit
|
2008-11-03 10:35:46 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "remove_old_db.ini"
|
2008-05-12 06:02:14 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
2008-11-03 10:35:46 +00:00
|
|
|
Function RemoveOldFilesPage
|
2008-12-09 12:38:04 +00:00
|
|
|
${DirState} "${MC2_DB_DIR}" $0
|
|
|
|
IntCmp $0 -1 0 +2 +2
|
|
|
|
Abort
|
2008-11-03 10:35:46 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT "mC2 installation" "Removing old database files"
|
2008-12-09 12:38:04 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "remove_old_db.ini" "Field 2" "Text" "Remove old mC2 databases in ${MC2_DB_DIR}"
|
2008-11-03 10:35:46 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "remove_old_db.ini"
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function RemoveOldFilesLeave
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $RemoveOldDatabases "remove_old_db.ini" "Field 2" "State"
|
|
|
|
FunctionEnd
|