Rev 123 | Rev 133 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | !include "MUI2.nsh" |
2 | !include "FileFunc.nsh" |
||
3 | |||
4 | !define PRODUCT_NAME "Chess Giants" |
||
5 | !define PUBLISHER "Pierre-Marie Baty" |
||
6 | !define PUBLISHER_WEBSITE "http://www.pmbaty.com/chess/" |
||
7 | !define INSTALLER_SRC "C:\Users\Pierre-Marie Baty\Documents\Mes projets\Chess Giants" |
||
8 | |||
9 | Name "${PRODUCT_NAME}" |
||
19 | pmbaty | 10 | BrandingText "${PRODUCT_NAME} by ${PUBLISHER} - ${PUBLISHER_WEBSITE}" |
1 | pmbaty | 11 | |
12 | SetCompressor lzma |
||
13 | RequestExecutionLevel user |
||
14 | |||
15 | AllowRootDirInstall true |
||
19 | pmbaty | 16 | InstallDir "$LOCALAPPDATA\${PRODUCT_NAME}" |
1 | pmbaty | 17 | |
19 | pmbaty | 18 | !define MUI_ICON "${INSTALLER_SRC}\resource\installer.ico" |
1 | pmbaty | 19 | !define MUI_HEADERIMAGE |
19 | pmbaty | 20 | !define MUI_HEADERIMAGE_BITMAP "${INSTALLER_SRC}\resource\installer.bmp" |
1 | pmbaty | 21 | !define MUI_ABORTWARNING |
22 | |||
23 | !insertmacro MUI_PAGE_LICENSE "${INSTALLER_SRC}\License.txt" |
||
24 | !insertmacro MUI_PAGE_DIRECTORY |
||
76 | pmbaty | 25 | |
26 | Var STR_HAYSTACK |
||
27 | Var STR_NEEDLE |
||
28 | Var STR_CONTAINS_VAR_1 |
||
29 | Var STR_CONTAINS_VAR_2 |
||
30 | Var STR_CONTAINS_VAR_3 |
||
31 | Var STR_CONTAINS_VAR_4 |
||
32 | Var STR_RETURN_VAR |
||
33 | |||
34 | Function StrContains |
||
35 | Exch $STR_NEEDLE |
||
36 | Exch 1 |
||
37 | Exch $STR_HAYSTACK |
||
38 | StrCpy $STR_RETURN_VAR "" |
||
39 | StrCpy $STR_CONTAINS_VAR_1 -1 |
||
40 | StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE |
||
41 | StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK |
||
42 | loop: |
||
43 | IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1 |
||
44 | StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1 |
||
45 | StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found |
||
46 | StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done |
||
47 | Goto loop |
||
48 | found: |
||
49 | StrCpy $STR_RETURN_VAR $STR_NEEDLE |
||
50 | Goto done |
||
51 | done: |
||
52 | Pop $STR_NEEDLE |
||
53 | Exch $STR_RETURN_VAR |
||
54 | FunctionEnd |
||
55 | !macro _StrContainsConstructor OUT NEEDLE HAYSTACK |
||
56 | Push `${HAYSTACK}` |
||
57 | Push `${NEEDLE}` |
||
58 | Call StrContains |
||
59 | Pop `${OUT}` |
||
60 | !macroend |
||
61 | |||
62 | !define StrContains '!insertmacro "_StrContainsConstructor"' |
||
63 | |||
64 | Function .onVerifyInstDir |
||
65 | Push $R0 |
||
66 | Push $R1 |
||
67 | ${StrContains} $0 "Program Files" "$INSTDIR" |
||
68 | StrCmp $0 "Program Files" pathbad |
||
69 | StrCpy $R0 "$INSTDIR" |
||
70 | loop: |
||
71 | StrLen $R1 "$R0" |
||
72 | StrCmp $R1 0 pathbad |
||
73 | IfFileExists "$R0" 0 parentLoop |
||
74 | ${GetFileAttributes} "$R0" "DIRECTORY" $R1 |
||
75 | StrCmp $R1 0 parentLoop |
||
76 | ${GetFileAttributes} "$R0" "READONLY" $R1 |
||
77 | StrCmp $R1 1 pathbad |
||
78 | ClearErrors |
||
79 | IfFileExists "$R0\.nsis_test_dir" pathgood 0 |
||
80 | CreateDirectory "$R0\.nsis_test_dir" |
||
81 | IfErrors pathbad 0 |
||
82 | RMDir "$R0\.nsis_test_dir" |
||
83 | Goto pathgood |
||
84 | parentLoop: |
||
85 | ${GetParent} "$R0" "$R0" |
||
86 | Goto loop |
||
87 | pathbad: |
||
88 | Abort |
||
89 | pathgood: |
||
90 | Pop $R1 |
||
91 | Pop $R0 |
||
92 | FunctionEnd |
||
93 | |||
1 | pmbaty | 94 | ;!insertmacro MUI_PAGE_COMPONENTS |
95 | !insertmacro MUI_PAGE_INSTFILES |
||
73 | pmbaty | 96 | AutoCloseWindow true |
1 | pmbaty | 97 | |
98 | !insertmacro MUI_UNPAGE_CONFIRM |
||
99 | !insertmacro MUI_UNPAGE_INSTFILES |
||
100 | |||
101 | !insertmacro MUI_LANGUAGE "English" |
||
102 | !insertmacro MUI_LANGUAGE "French" |
||
103 | |||
104 | Section "" |
||
105 | SetOutPath "$INSTDIR" |
||
106 | |||
107 | File /r "${INSTALLER_SRC}\data" |
||
44 | pmbaty | 108 | File /r "${INSTALLER_SRC}\engines" |
1 | pmbaty | 109 | File /r "${INSTALLER_SRC}\helpfiles" |
110 | File /r "${INSTALLER_SRC}\themes" |
||
111 | File "${INSTALLER_SRC}\*.pgn" |
||
112 | File "${INSTALLER_SRC}\${PRODUCT_NAME}.exe" |
||
113 | File "${INSTALLER_SRC}\${PRODUCT_NAME}.exe.manifest" |
||
29 | pmbaty | 114 | File "${INSTALLER_SRC}\Chess Giants (English).html" |
115 | File "${INSTALLER_SRC}\Chess Giants (French).html" |
||
1 | pmbaty | 116 | File "${INSTALLER_SRC}\config.ini" |
117 | File "${INSTALLER_SRC}\materials.cfg" |
||
118 | File "${INSTALLER_SRC}\d3dx9_42.dll" |
||
119 | File "${INSTALLER_SRC}\msvcr90.dll" |
||
117 | pmbaty | 120 | File "${INSTALLER_SRC}\openal32.dll" |
118 | pmbaty | 121 | File "${INSTALLER_SRC}\wrap_oal.dll" |
1 | pmbaty | 122 | |
123 | CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "" "" "" "" "" "Start a chess game" |
||
124 | CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" |
||
125 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "" "" "" "" "" "Start a chess game" |
||
29 | pmbaty | 126 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Documentation (English).lnk" "$INSTDIR\Chess Giants (English).html" "" "" "" "" "" "Read the software documentation in English" |
127 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Documentation (Français).lnk" "$INSTDIR\Chess Giants (French).html" "" "" "" "" "" "Read the software documentation in French" |
||
1 | pmbaty | 128 | |
129 | WriteRegStr HKCU "Software\Classes\.pgn" "" "ChessGiantsPGN" |
||
130 | WriteRegStr HKCU "Software\Classes\ChessGiantsPGN" "" "Portable Game Notation" |
||
131 | ; WriteRegStr HKCU "Software\Classes\ChessGiantsPGN\DefaultIcon" "" "$INSTDIR\${PRODUCT_NAME}.exe,1" |
||
132 | WriteRegStr HKCU "Software\Classes\ChessGiantsPGN\shell\open\command" "" '"$INSTDIR\${PRODUCT_NAME}.exe" "%1"' |
||
133 | |||
134 | WriteRegStr HKCU "Software\Classes\.fen" "" "ChessGiantsFEN" |
||
135 | WriteRegStr HKCU "Software\Classes\ChessGiantsFEN" "" "Forsyth-Edwards Notation" |
||
136 | ; WriteRegStr HKCU "Software\Classes\ChessGiantsFEN\DefaultIcon" "" "$INSTDIR\${PRODUCT_NAME}.exe,1" |
||
137 | WriteRegStr HKCU "Software\Classes\ChessGiantsFEN\shell\open\command" "" '"$INSTDIR\${PRODUCT_NAME}.exe" "%1"' |
||
138 | |||
139 | WriteUninstaller $INSTDIR\uninstall.exe |
||
140 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME}" |
||
55 | pmbaty | 141 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_NAME}.exe,0" |
1 | pmbaty | 142 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" |
143 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" |
||
144 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Publisher" "${PUBLISHER}" |
||
145 | WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoModify" 1 |
||
146 | WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoRepair" 1 |
||
147 | ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 |
||
148 | IntFmt $0 "0x%08X" $0 |
||
149 | WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "EstimatedSize" "$0" |
||
73 | pmbaty | 150 | |
151 | Exec '"$WINDIR\explorer.exe" "$INSTDIR\${PRODUCT_NAME}.exe"' |
||
1 | pmbaty | 152 | SectionEnd |
14 | pmbaty | 153 | |
1 | pmbaty | 154 | Section "Uninstall" |
155 | DeleteRegKey HKCU "Software\Classes\.pgn" |
||
156 | DeleteRegKey HKCU "Software\Classes\ChessGiantsPGN" |
||
157 | DeleteRegKey HKCU "Software\Classes\.fen" |
||
158 | DeleteRegKey HKCU "Software\Classes\ChessGiantsFEN" |
||
159 | |||
160 | Delete "$DESKTOP\${PRODUCT_NAME}.lnk" |
||
161 | RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}" |
||
162 | RMDir /r "$INSTDIR" |
||
163 | |||
164 | DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" |
||
165 | SectionEnd |