Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | # NSIS file to create a self-installing exe for Vim. |
| 2 | # It requires NSIS version 2.0 or later. |
Bram Moolenaar | 0434482 | 2014-11-05 18:18:17 +0100 | [diff] [blame] | 3 | # Last Change: 2014 Nov 5 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4 | |
| 5 | # WARNING: if you make changes to this script, look out for $0 to be valid, |
| 6 | # because uninstall deletes most files in $0. |
| 7 | |
Bram Moolenaar | ba46075 | 2013-07-04 22:35:01 +0200 | [diff] [blame] | 8 | # Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc. |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 9 | !ifndef VIMSRC |
| 10 | !define VIMSRC "..\src" |
| 11 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 12 | |
| 13 | # Location of runtime files |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 14 | !ifndef VIMRT |
| 15 | !define VIMRT ".." |
| 16 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 17 | |
| 18 | # Location of extra tools: diff.exe |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 19 | !ifndef VIMTOOLS |
| 20 | !define VIMTOOLS ..\.. |
| 21 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 22 | |
| 23 | # Comment the next line if you don't have UPX. |
| 24 | # Get it at http://upx.sourceforge.net |
| 25 | !define HAVE_UPX |
| 26 | |
| 27 | # comment the next line if you do not want to add Native Language Support |
| 28 | !define HAVE_NLS |
| 29 | |
Bram Moolenaar | 6c7b444 | 2016-01-02 15:44:32 +0100 | [diff] [blame] | 30 | !include gvim_version.nsh # for version number |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 31 | |
| 32 | # ----------- No configurable settings below this line ----------- |
| 33 | |
| 34 | !include UpgradeDLL.nsh # for VisVim.dll |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 35 | !include LogicLib.nsh |
| 36 | !include x64.nsh |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 37 | |
| 38 | Name "Vim ${VER_MAJOR}.${VER_MINOR}" |
| 39 | OutFile gvim${VER_MAJOR}${VER_MINOR}.exe |
| 40 | CRCCheck force |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 41 | SetCompressor /SOLID lzma |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 42 | SetDatablockOptimize on |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 43 | RequestExecutionLevel highest |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 44 | XPStyle on |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 45 | |
| 46 | ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." |
Bram Moolenaar | 0434482 | 2014-11-05 18:18:17 +0100 | [diff] [blame] | 47 | DirText "Choose a directory to install Vim (should contain 'vim')" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 48 | Icon icons\vim_16c.ico |
Bram Moolenaar | 266411a | 2013-07-05 20:01:32 +0200 | [diff] [blame] | 49 | # NSIS2 uses a different strategy with six different images in a strip... |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 50 | #EnabledBitmap icons\enabled.bmp |
| 51 | #DisabledBitmap icons\disabled.bmp |
| 52 | UninstallText "This will uninstall Vim ${VER_MAJOR}.${VER_MINOR} from your system." |
| 53 | UninstallIcon icons\vim_uninst_16c.ico |
| 54 | |
| 55 | # On NSIS 2 using the BGGradient causes trouble on Windows 98, in combination |
| 56 | # with the BringToFront. |
| 57 | # BGGradient 004000 008200 FFFFFF |
| 58 | LicenseText "You should read the following before installing:" |
| 59 | LicenseData ${VIMRT}\doc\uganda.nsis.txt |
| 60 | |
| 61 | !ifdef HAVE_UPX |
| 62 | !packhdr temp.dat "upx --best --compress-icons=1 temp.dat" |
| 63 | !endif |
| 64 | |
| 65 | # This adds '\vim' to the user choice automagically. The actual value is |
| 66 | # obtained below with ReadINIStr. |
| 67 | InstallDir "$PROGRAMFILES\Vim" |
| 68 | |
| 69 | # Types of installs we can perform: |
| 70 | InstType Typical |
| 71 | InstType Minimal |
| 72 | InstType Full |
| 73 | |
| 74 | SilentInstall normal |
| 75 | |
| 76 | # These are the pages we use |
| 77 | Page license |
| 78 | Page components |
| 79 | Page directory "" "" CheckInstallDir |
| 80 | Page instfiles |
| 81 | UninstPage uninstConfirm |
| 82 | UninstPage instfiles |
| 83 | |
| 84 | ########################################################## |
| 85 | # Functions |
| 86 | |
| 87 | Function .onInit |
| 88 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
| 89 | "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \ |
| 90 | IDYES NoAbort |
| 91 | Abort ; causes installer to quit. |
| 92 | NoAbort: |
| 93 | |
| 94 | # run the install program to check for already installed versions |
| 95 | SetOutPath $TEMP |
| 96 | File /oname=install.exe ${VIMSRC}\installw32.exe |
| 97 | ExecWait "$TEMP\install.exe -uninstall-check" |
| 98 | Delete $TEMP\install.exe |
| 99 | |
| 100 | # We may have been put to the background when uninstall did something. |
| 101 | BringToFront |
| 102 | |
| 103 | # Install will have created a file for us that contains the directory where |
| 104 | # we should install. This is $VIM if it's set. This appears to be the only |
| 105 | # way to get the value of $VIM here!? |
| 106 | ReadINIStr $INSTDIR $TEMP\vimini.ini vimini dir |
| 107 | Delete $TEMP\vimini.ini |
| 108 | |
| 109 | # If ReadINIStr failed or did not find a path: use the default dir. |
| 110 | StrCmp $INSTDIR "" 0 IniOK |
| 111 | StrCpy $INSTDIR "$PROGRAMFILES\Vim" |
| 112 | IniOK: |
| 113 | |
| 114 | # Should check for the value of $VIM and use it. Unfortunately I don't know |
| 115 | # how to obtain the value of $VIM |
| 116 | # IfFileExists "$VIM" 0 No_Vim |
| 117 | # StrCpy $INSTDIR "$VIM" |
| 118 | # No_Vim: |
| 119 | |
| 120 | # User variables: |
| 121 | # $0 - holds the directory the executables are installed to |
| 122 | # $1 - holds the parameters to be passed to install.exe. Starts with OLE |
| 123 | # registration (since a non-OLE gvim will not complain, and we want to |
| 124 | # always register an OLE gvim). |
| 125 | # $2 - holds the names to create batch files for |
| 126 | StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" |
| 127 | StrCpy $1 "-register-OLE" |
Bram Moolenaar | 7fcab2a | 2006-03-25 21:46:12 +0000 | [diff] [blame] | 128 | StrCpy $2 "gvim evim gview gvimdiff vimtutor" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 129 | |
| 130 | FunctionEnd |
| 131 | |
| 132 | Function .onUserAbort |
| 133 | MessageBox MB_YESNO|MB_ICONQUESTION "Abort install?" IDYES NoCancelAbort |
| 134 | Abort ; causes installer to not quit. |
| 135 | NoCancelAbort: |
| 136 | FunctionEnd |
| 137 | |
| 138 | # We only accept the directory if it ends in "vim". Using .onVerifyInstDir has |
| 139 | # the disadvantage that the browse dialog is difficult to use. |
| 140 | Function CheckInstallDir |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 141 | FunctionEnd |
| 142 | |
| 143 | Function .onInstSuccess |
| 144 | WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe |
| 145 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
Bram Moolenaar | f233048 | 2008-06-24 20:19:36 +0000 | [diff] [blame] | 146 | "The installation process has been successful. Happy Vimming! \ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 147 | $\n$\n Do you want to see the README file now?" IDNO NoReadme |
| 148 | Exec '$0\gvim.exe -R "$0\README.txt"' |
| 149 | NoReadme: |
| 150 | FunctionEnd |
| 151 | |
| 152 | Function .onInstFailed |
| 153 | MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed. Better luck next time." |
| 154 | FunctionEnd |
| 155 | |
| 156 | Function un.onUnInstSuccess |
| 157 | MessageBox MB_OK|MB_ICONINFORMATION \ |
| 158 | "Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system" |
| 159 | FunctionEnd |
| 160 | |
| 161 | Function un.GetParent |
| 162 | Exch $0 ; old $0 is on top of stack |
| 163 | Push $1 |
| 164 | Push $2 |
| 165 | StrCpy $1 -1 |
| 166 | loop: |
| 167 | StrCpy $2 $0 1 $1 |
| 168 | StrCmp $2 "" exit |
| 169 | StrCmp $2 "\" exit |
| 170 | IntOp $1 $1 - 1 |
| 171 | Goto loop |
| 172 | exit: |
| 173 | StrCpy $0 $0 $1 |
| 174 | Pop $2 |
| 175 | Pop $1 |
| 176 | Exch $0 ; put $0 on top of stack, restore $0 to original value |
| 177 | FunctionEnd |
| 178 | |
| 179 | ########################################################## |
| 180 | Section "Vim executables and runtime files" |
| 181 | SectionIn 1 2 3 |
| 182 | |
| 183 | # we need also this here if the user changes the instdir |
| 184 | StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" |
| 185 | |
| 186 | SetOutPath $0 |
| 187 | File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe |
| 188 | File /oname=install.exe ${VIMSRC}\installw32.exe |
| 189 | File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe |
| 190 | File ${VIMSRC}\vimrun.exe |
Bram Moolenaar | fec246d | 2016-08-28 18:47:14 +0200 | [diff] [blame] | 191 | File /oname=tee.exe ${VIMSRC}\teew32.exe |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 192 | File /oname=xxd.exe ${VIMSRC}\xxdw32.exe |
| 193 | File ${VIMTOOLS}\diff.exe |
| 194 | File ${VIMRT}\vimtutor.bat |
| 195 | File ${VIMRT}\README.txt |
| 196 | File ..\uninstal.txt |
| 197 | File ${VIMRT}\*.vim |
| 198 | File ${VIMRT}\rgb.txt |
| 199 | |
| 200 | SetOutPath $0\colors |
| 201 | File ${VIMRT}\colors\*.* |
| 202 | |
| 203 | SetOutPath $0\compiler |
| 204 | File ${VIMRT}\compiler\*.* |
| 205 | |
| 206 | SetOutPath $0\doc |
| 207 | File ${VIMRT}\doc\*.txt |
| 208 | File ${VIMRT}\doc\tags |
| 209 | |
| 210 | SetOutPath $0\ftplugin |
| 211 | File ${VIMRT}\ftplugin\*.* |
| 212 | |
| 213 | SetOutPath $0\indent |
| 214 | File ${VIMRT}\indent\*.* |
| 215 | |
| 216 | SetOutPath $0\macros |
| 217 | File ${VIMRT}\macros\*.* |
| 218 | |
Bram Moolenaar | c7baa43 | 2016-04-26 17:34:44 +0200 | [diff] [blame] | 219 | SetOutPath $0\pack\dist\opt\dvorak\dvorak |
| 220 | File ${VIMRT}\pack\dist\opt\dvorak\dvorak\*.* |
| 221 | SetOutPath $0\pack\dist\opt\dvorak\plugin |
| 222 | File ${VIMRT}\pack\dist\opt\dvorak\plugin\*.* |
| 223 | |
| 224 | SetOutPath $0\pack\dist\opt\editexisting\plugin |
| 225 | File ${VIMRT}\pack\dist\opt\editexisting\plugin\*.* |
| 226 | |
| 227 | SetOutPath $0\pack\dist\opt\justify\plugin |
| 228 | File ${VIMRT}\pack\dist\opt\justify\plugin\*.* |
| 229 | |
| 230 | SetOutPath $0\pack\dist\opt\matchit\doc |
| 231 | File ${VIMRT}\pack\dist\opt\matchit\doc\*.* |
| 232 | SetOutPath $0\pack\dist\opt\matchit\plugin |
| 233 | File ${VIMRT}\pack\dist\opt\matchit\plugin\*.* |
| 234 | |
| 235 | SetOutPath $0\pack\dist\opt\shellmenu\plugin |
| 236 | File ${VIMRT}\pack\dist\opt\shellmenu\plugin\*.* |
| 237 | |
| 238 | SetOutPath $0\pack\dist\opt\swapmouse\plugin |
| 239 | File ${VIMRT}\pack\dist\opt\swapmouse\plugin\*.* |
| 240 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 241 | SetOutPath $0\plugin |
| 242 | File ${VIMRT}\plugin\*.* |
| 243 | |
Bram Moolenaar | 7fcab2a | 2006-03-25 21:46:12 +0000 | [diff] [blame] | 244 | SetOutPath $0\autoload |
| 245 | File ${VIMRT}\autoload\*.* |
| 246 | |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 247 | SetOutPath $0\autoload\xml |
| 248 | File ${VIMRT}\autoload\xml\*.* |
| 249 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 250 | SetOutPath $0\syntax |
| 251 | File ${VIMRT}\syntax\*.* |
| 252 | |
Bram Moolenaar | c01140a | 2006-03-24 22:21:52 +0000 | [diff] [blame] | 253 | SetOutPath $0\spell |
| 254 | File ${VIMRT}\spell\*.txt |
| 255 | File ${VIMRT}\spell\*.vim |
| 256 | File ${VIMRT}\spell\*.spl |
| 257 | File ${VIMRT}\spell\*.sug |
| 258 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 259 | SetOutPath $0\tools |
| 260 | File ${VIMRT}\tools\*.* |
| 261 | |
| 262 | SetOutPath $0\tutor |
| 263 | File ${VIMRT}\tutor\*.* |
| 264 | SectionEnd |
| 265 | |
| 266 | ########################################################## |
| 267 | Section "Vim console program (vim.exe)" |
| 268 | SectionIn 1 3 |
| 269 | |
| 270 | SetOutPath $0 |
| 271 | ReadRegStr $R0 HKLM \ |
| 272 | "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion |
| 273 | IfErrors 0 lbl_winnt |
Bram Moolenaar | ba46075 | 2013-07-04 22:35:01 +0200 | [diff] [blame] | 274 | # Windows 95/98/ME: not supported |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 275 | Goto lbl_done |
| 276 | lbl_winnt: |
Bram Moolenaar | 266411a | 2013-07-05 20:01:32 +0200 | [diff] [blame] | 277 | # Windows NT/2000/XP and later |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 278 | File /oname=vim.exe ${VIMSRC}\vimw32.exe |
| 279 | lbl_done: |
| 280 | StrCpy $2 "$2 vim view vimdiff" |
| 281 | SectionEnd |
| 282 | |
| 283 | ########################################################## |
| 284 | Section "Create .bat files for command line use" |
| 285 | SectionIn 3 |
| 286 | |
| 287 | StrCpy $1 "$1 -create-batfiles $2" |
| 288 | SectionEnd |
| 289 | |
| 290 | ########################################################## |
| 291 | Section "Create icons on the Desktop" |
| 292 | SectionIn 1 3 |
| 293 | |
| 294 | StrCpy $1 "$1 -install-icons" |
| 295 | SectionEnd |
| 296 | |
| 297 | ########################################################## |
| 298 | Section "Add Vim to the Start Menu" |
| 299 | SectionIn 1 3 |
| 300 | |
| 301 | StrCpy $1 "$1 -add-start-menu" |
| 302 | SectionEnd |
| 303 | |
| 304 | ########################################################## |
| 305 | Section "Add an Edit-with-Vim context menu entry" |
| 306 | SectionIn 1 3 |
| 307 | |
| 308 | # Be aware of this sequence of events: |
| 309 | # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and |
| 310 | # is scheduled to be removed at next reboot. |
| 311 | # - user installs Vim in same directory, gvimext.dll still exists. |
| 312 | # If we now skip installing gvimext.dll, it will disappear at the next |
| 313 | # reboot. Thus when copying gvimext.dll fails always schedule it to be |
| 314 | # installed at the next reboot. Can't use UpgradeDLL! |
| 315 | # We don't ask the user to reboot, the old dll will keep on working. |
| 316 | SetOutPath $0 |
| 317 | ClearErrors |
| 318 | SetOverwrite try |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 319 | ${If} ${RunningX64} |
| 320 | File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll |
| 321 | ${Else} |
| 322 | File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll |
| 323 | ${EndIf} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 324 | IfErrors 0 GvimExtDone |
| 325 | |
| 326 | # Can't copy gvimext.dll, create it under another name and rename it on |
| 327 | # next reboot. |
| 328 | GetTempFileName $3 $0 |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 329 | ${If} ${RunningX64} |
| 330 | File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll |
| 331 | ${Else} |
| 332 | File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll |
| 333 | ${EndIf} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 334 | Rename /REBOOTOK $3 $0\gvimext.dll |
| 335 | |
| 336 | GvimExtDone: |
| 337 | SetOverwrite lastused |
| 338 | |
| 339 | # We don't have a separate entry for the "Open With..." menu, assume |
| 340 | # the user wants either both or none. |
| 341 | StrCpy $1 "$1 -install-popup -install-openwith" |
| 342 | SectionEnd |
| 343 | |
| 344 | ########################################################## |
| 345 | Section "Create a _vimrc if it doesn't exist" |
| 346 | SectionIn 1 3 |
| 347 | |
| 348 | StrCpy $1 "$1 -create-vimrc" |
| 349 | SectionEnd |
| 350 | |
| 351 | ########################################################## |
| 352 | Section "Create plugin directories in HOME or VIM" |
| 353 | SectionIn 1 3 |
| 354 | |
| 355 | StrCpy $1 "$1 -create-directories home" |
| 356 | SectionEnd |
| 357 | |
| 358 | ########################################################## |
| 359 | Section "Create plugin directories in VIM" |
| 360 | SectionIn 3 |
| 361 | |
| 362 | StrCpy $1 "$1 -create-directories vim" |
| 363 | SectionEnd |
| 364 | |
| 365 | ########################################################## |
| 366 | Section "VisVim Extension for MS Visual Studio" |
| 367 | SectionIn 3 |
| 368 | |
| 369 | SetOutPath $0 |
| 370 | !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0" |
| 371 | File ${VIMSRC}\VisVim\README_VisVim.txt |
| 372 | SectionEnd |
| 373 | |
| 374 | ########################################################## |
| 375 | !ifdef HAVE_NLS |
| 376 | Section "Native Language Support" |
| 377 | SectionIn 1 3 |
| 378 | |
| 379 | SetOutPath $0\lang |
| 380 | File /r ${VIMRT}\lang\*.* |
| 381 | SetOutPath $0\keymap |
| 382 | File ${VIMRT}\keymap\README.txt |
| 383 | File ${VIMRT}\keymap\*.vim |
| 384 | SetOutPath $0 |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 385 | File ${VIMRT}\libintl-8.dll |
| 386 | File ${VIMRT}\libiconv-2.dll |
| 387 | File /nonfatal ${VIMRT}\libwinpthread-1.dll |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 388 | SectionEnd |
| 389 | !endif |
| 390 | |
| 391 | ########################################################## |
| 392 | Section -call_install_exe |
| 393 | SetOutPath $0 |
| 394 | ExecWait "$0\install.exe $1" |
| 395 | SectionEnd |
| 396 | |
| 397 | ########################################################## |
| 398 | Section -post |
| 399 | BringToFront |
| 400 | SectionEnd |
| 401 | |
| 402 | ########################################################## |
| 403 | Section Uninstall |
| 404 | # Apparently $INSTDIR is set to the directory where the uninstaller is |
| 405 | # created. Thus the "vim61" directory is included in it. |
| 406 | StrCpy $0 "$INSTDIR" |
| 407 | |
| 408 | # If VisVim was installed, unregister the DLL. |
| 409 | IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim |
| 410 | Has_VisVim: |
| 411 | ExecWait "regsvr32.exe /u /s $0\VisVim.dll" |
| 412 | |
| 413 | No_VisVim: |
| 414 | |
| 415 | # delete the context menu entry and batch files |
| 416 | ExecWait "$0\uninstal.exe -nsis" |
| 417 | |
| 418 | # We may have been put to the background when uninstall did something. |
| 419 | BringToFront |
| 420 | |
| 421 | # ask the user if the Vim version dir must be removed |
| 422 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
| 423 | "Would you like to delete $0?$\n \ |
| 424 | $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes |
| 425 | |
| 426 | Delete /REBOOTOK $0\*.dll |
| 427 | ClearErrors |
| 428 | # Remove everything but *.dll files. Avoids that |
| 429 | # a lot remains when gvimext.dll cannot be deleted. |
Bram Moolenaar | 408b585 | 2006-05-13 10:44:07 +0000 | [diff] [blame] | 430 | RMDir /r $0\autoload |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 431 | RMDir /r $0\colors |
| 432 | RMDir /r $0\compiler |
| 433 | RMDir /r $0\doc |
| 434 | RMDir /r $0\ftplugin |
| 435 | RMDir /r $0\indent |
| 436 | RMDir /r $0\macros |
| 437 | RMDir /r $0\plugin |
Bram Moolenaar | 408b585 | 2006-05-13 10:44:07 +0000 | [diff] [blame] | 438 | RMDir /r $0\spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 439 | RMDir /r $0\syntax |
| 440 | RMDir /r $0\tools |
| 441 | RMDir /r $0\tutor |
| 442 | RMDir /r $0\VisVim |
| 443 | RMDir /r $0\lang |
| 444 | RMDir /r $0\keymap |
| 445 | Delete $0\*.exe |
| 446 | Delete $0\*.bat |
| 447 | Delete $0\*.vim |
| 448 | Delete $0\*.txt |
| 449 | |
| 450 | IfErrors ErrorMess NoErrorMess |
| 451 | ErrorMess: |
| 452 | MessageBox MB_OK|MB_ICONEXCLAMATION \ |
| 453 | "Some files in $0 have not been deleted!$\nYou must do it manually." |
| 454 | NoErrorMess: |
| 455 | |
| 456 | # No error message if the "vim62" directory can't be removed, the |
| 457 | # gvimext.dll may still be there. |
| 458 | RMDir $0 |
| 459 | |
| 460 | NoRemoveExes: |
| 461 | # get the parent dir of the installation |
| 462 | Push $INSTDIR |
| 463 | Call un.GetParent |
| 464 | Pop $0 |
| 465 | StrCpy $1 $0 |
| 466 | |
| 467 | # if a plugin dir was created at installation ask the user to remove it |
| 468 | # first look in the root of the installation then in HOME |
| 469 | IfFileExists $1\vimfiles AskRemove 0 |
| 470 | ReadEnvStr $1 "HOME" |
| 471 | StrCmp $1 "" NoRemove 0 |
| 472 | |
| 473 | IfFileExists $1\vimfiles 0 NoRemove |
| 474 | |
| 475 | AskRemove: |
| 476 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
Bram Moolenaar | e04abda | 2010-08-01 22:35:43 +0200 | [diff] [blame] | 477 | "Remove all files in your $1\vimfiles directory?$\n \ |
Bram Moolenaar | 760d14a | 2010-07-31 22:03:44 +0200 | [diff] [blame] | 478 | $\nCAREFUL: If you have created something there that you want to keep, click No" IDNO Fin |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 479 | RMDir /r $1\vimfiles |
| 480 | NoRemove: |
| 481 | |
| 482 | # ask the user if the Vim root dir must be removed |
| 483 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
| 484 | "Would you like to remove $0?$\n \ |
| 485 | $\nIt contains your Vim configuration files!" IDNO NoDelete |
| 486 | RMDir /r $0 ; skipped if no |
| 487 | NoDelete: |
| 488 | |
| 489 | Fin: |
| 490 | Call un.onUnInstSuccess |
| 491 | |
| 492 | SectionEnd |