1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
|
###################################################################################################
# setup.nsi
#
# This file contains the NSIS setup script for the Windows version of POV-Ray.
#
# Compiling this file requires the Nullsoft Scriptable Install System. It has only been tested with
# NSIS v2.46.
#
# Before compiling please read "Customization Notes" below. Once you have set up your distribution
# tree and updated the variable definitions in this file, you may execute "makensis setup.nsi" to
# build the output file.
#
###################################################################################################
#
# Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
# Copyright 1991-2013 Persistence of Vision Raytracer Pty. Ltd.
#
# POV-Ray is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# POV-Ray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################################
#
# $File: //depot/public/povray/3.x/windows/setup.nsi $
# $Revision: #1 $
# $Change: 6069 $
# $DateTime: 2013/11/06 11:59:40 $
# $Author: chrisc $
#
###################################################################################################
#
# Customization Notes:
#
# Please read these instructions in order to customize this install script for your use. Doing so
# involves two main steps: firstly, setting up a install tree containing the files in a particular
# layout, and secondly changing various variables, such as adding your name to the 'Company' field,
# choosing the default destination (please do not use the same default as official POV-Ray), and so
# on. Once you have done all of this you should comment-out the '!error' directive below.
#
# You must set INSTROOT to point at a tree containing a set of files in the layout expected by this
# script. Basically the tree as presented here is almost identical to what will end up on the target
# system's drive, divided into two sections: core files (usable by everyone) and user-specific files
# (need to be installed for each user). This looks something like the following:
#
# ./agpl-3.0.txt
# ./changes.txt
# ./revision.txt
# ./core
# ./core/bin
# ./core/help
# ./core/sounds
# ./core/tiles
# ./user
# ./user/include
# ./user/ini
# ./user/Insert Menu
# ./user/scenes
#
# Note in particular that within the ./core/bin directory you must re-name any files that contain
# 'POV-Ray' to contain ${MYABBREV} as defined below; e.g. using the example 'Laser-Ray' abbreviation
# "POV-Ray.Scene.ico" would become "Laser-Ray.Scene.ico". Additionally any files prefixed with
# "pvengine" (e.g. all default EXE's) must have that prefix replaced with ${MYEXEPREFIX}.
#
# Additionally some files not part of the build are added to ./core/bin allow for supporting dumps;
# these are dbghelp.dll and submitminidump.exe. The former is available from Microsoft and may be
# omitted if you do not wish to support writing minidumps if the program crashes, and the latter
# (which uploads minidumps to the POV-Ray bug tracker) is only part of official distributions and
# should never be part of a custom install.
#
# Apart from the above extra DLL's, the only other files needed in ./core/bin are the icons used for
# shortcuts; you may copy these from distribution/platform-specific/windows/icons/ (but be sure to
# re-name them as discussed above).
#
# NB: The path 'distribution/' refers to the directory of that name in the standard POV-Ray source
# tree (on the same level as 'libraries', 'source', 'vfe', 'unix', etc).
#
# ./agpl-3.0.txt copied from distribution/
# ./changes.txt copied from the top-level of the source tree
# ./revision.txt copied from the top-level of the source tree
#
# ./core/help/ copied from distribution/platform-specific/windows/help/
# ./core/sounds/ copied from distribution/platform-specific/windows/sounds/
# ./core/tiles/ copied from distribution/platform-specific/windows/tiles/
#
# It is safe to omit ./core/sounds/ and ./core/tiles/ if you wish. in particular the tiles are
# rarely used nowadays (defaulting to being off - they are a feature from the mid 1990's).
#
# ./user/include/ copied from distribution/include/
# ./user/ini/ copied from distribution/ini/ and distribution/platform-specific/windows/ini/
# ./user/Insert Menu/ copied from distribution/platform-specific/windows/Insert Menu/
# ./user/scenes/ copied from distribution/scenes/
#
# Please keep in mind that the compiled executables will look in a particular location in the registry
# for the install path (so that they can find the include and INI files, for example). Generally it
# can work this out automatically but nevertheless it is best to ensure that the registry path compiled
# in is the same as the registry path constructed by this installer. The path is constructed as follows:
#
# HKCU\SOFTWARE\${MYCOMPANY}\${MYPRODUCT}\${VERSIONSTR}
#
# e.g. given the below defaults, "HKCU\Software\Acme Space Blasters Inc.\Laser-Ray Pro\v1.1". POVWIN
# declares its registry path macros in PVEDIT.H, so look there to see what it is using.
#
# NOTE: If your version acts differently from the official POV-Ray sources from which it is derived
# you are strongly urged to change MYSCENEEXT below to something other than 'pov' (and re-name the
# sample scenes accordingly). Failing to do this could result in your version taking over the .POV
# file association on another users system (presuming that user has already installed POV-Ray). If
# your version is not a 1:1 direct replacement for the official version this may not be desirable.
# In addition, if that user ever installs an official distribution of POV-Ray after having installed
# your renderer, the opposite will happen: POV-Ray will take over the association (reasonable given
# .POV files have been the default extension for POV-Ray for more than 20 years).
#
###################################################################################################
# READ THE ABOVE THEN MODIFY THE FOLLOWING VARIABLES TO SUIT YOUR INSTALLATION.
!error "READ INSTRUCTIONS IN SETUP.NSI TO AVOID THIS ERROR"
!define INSTROOT "c:\read\setup.nsi\and\change\this"
!define MYCOMPANY "Acme Space Blasters Inc."
!define MYPRODUCT "Laser-Ray Pro"
!define MYABBREV "Laser-Ray"
!define MYVER "1.1"
!define MYSUBVER "0.0"
!define MYURL "http://acme-space-blasters.tycho.mars/"
!define MYCOPYRIGHT "Copyright(c) 2050-2051 Acme Space Blasters. Inc."
!define MYEXEPREFIX "lasray"
!define MYSCENEEXT "pov"
!define MYHELPFILE "povray37.chm"
###################################################################################################
RequestExecutionLevel highest
SetCompressor /SOLID lzma
Name "${MYPRODUCT}"
!define VERSIONSTR "v${MYVER}"
!define BINDEST "${MYCOMPANY}\${MYPRODUCT}\${VERSIONSTR}"
!define DOCDEST "$DOCUMENTS\${MYCOMPANY}\${MYPRODUCT}\${VERSIONSTR}"
!define REGKEY "SOFTWARE\${MYCOMPANY}\${MYPRODUCT}\${VERSIONSTR}"
!define UNINSTALL_REG_SUFFIX "${VERSIONSTR}"
!define URL ${MYURL}
# MUI Symbol Definitions
!define MUI_ICON "${INSTROOT}\Core\Bin\${MYABBREV}.ico"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKCU
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${REGKEY}\Components"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${MYPRODUCT} ${VERSIONSTR}"
!define MUI_UNICON "${INSTROOT}\Core\Bin\${MYABBREV}.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_SHOWREADME "$DocDir\changes.txt"
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Display change list."
# Included files
!include Sections.nsh
!include MUI2.nsh
!include x64.nsh
!include FileFunc.nsh
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of $(^NameDA) ${VERSIONSTR}.$\r$\n$\r$\nPress Next to continue."
!define MUI_UNCONFIRMPAGE_TEXT_TOP "The following $(^NameDA) installation will be uninstalled.$\r$\n$\r$\nNOTE: The scenes, include and INI files associated with the install will not be removed."
# Variables
Var StartMenuGroup
Var TargetEXE
Var BinDir
Var DocDir
var Dialog
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE ${INSTROOT}\agpl-3.0.txt
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE BinDirectoryLeave
!define MUI_DIRECTORYPAGE_VARIABLE $BinDir
!define MUI_DIRECTORYPAGE_TEXT_TOP "Setup will install the core $(^NameDA) files in the following location. Click Browse to select a different folder."
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DocDirectoryLeave
!define MUI_DIRECTORYPAGE_VARIABLE $DocDir
!define MUI_DIRECTORYPAGE_TEXT_TOP "Setup will install the $(^NameDA) include and sample scene files in the following location. Click Browse to select a different folder."
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
Page custom ReadyToInstall
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE English
# Installer attributes
OutFile "${MYPRODUCT}.${VERSIONSTR}-setup.exe"
InstallDir $BinDir
CRCCheck on
XPStyle on
ShowInstDetails show
VIProductVersion ${MYVER}.${MYSUBVER}
VIAddVersionKey ProductName "${MYPRODUCT}"
VIAddVersionKey ProductVersion "${MYVER}"
VIAddVersionKey CompanyName "${MYCOMPANY}"
VIAddVersionKey CompanyWebsite "${MYURL}"
VIAddVersionKey FileVersion "${MYVER}"
VIAddVersionKey FileDescription "${MYPRODUCT} ${MYVER}"
VIAddVersionKey LegalCopyright "${MYCOPYRIGHT}"
InstallDirRegKey HKCU "${REGKEY}\Windows" Home
ShowUninstDetails show
# Installer sections
Section -Main SEC0000
SetShellVarContext current
# remove the registry key, if present
DeleteRegKey HKCU "${REGKEY}"
SetOutPath "$BinDir"
SetOverwrite on
File ${INSTROOT}\agpl-3.0.txt
File ${INSTROOT}\revision.txt
File ${INSTROOT}\changes.txt
File /r ${INSTROOT}\Core\*
WriteRegStr HKCU "${REGKEY}\Components" Main 1
SectionEnd
Section "User Files" SEC0001
SetOutPath "$DocDir"
SetOverwrite on
File ${INSTROOT}\agpl-3.0.txt
File ${INSTROOT}\revision.txt
File ${INSTROOT}\changes.txt
File /r ${INSTROOT}\User\*
WriteRegStr HKCU "${REGKEY}\Components" "User Files" 1
SectionEnd
Section -post SEC0002
WriteRegStr HKCU "${REGKEY}\Windows" Home "$BinDir"
WriteRegStr HKCU "${REGKEY}\Windows" DocPath "$DocDir"
WriteRegDWORD HKCU "${REGKEY}\Windows" FreshInstall 1
SetOutPath "$BinDir"
WriteUninstaller $BinDir\${MYEXEPREFIX}-${MYVER}-uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath "$SMPROGRAMS\$StartMenuGroup"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\${MYPRODUCT}.lnk" "$BinDir\bin\$TargetEXE"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\License.lnk" "$BinDir\agpl-3.0.txt"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Documentation.lnk" "$BinDir\help\${MYHELPFILE}"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Release Notes.lnk" "$DocDir\changes.txt"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Change List.lnk" "$DocDir\revision.txt"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Sample Scenes.lnk" "$DocDir\Scenes"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Scene Previews.lnk" "$DocDir\Scenes\index.htm"
CreateShortcut "$Desktop\${MYABBREV} ${VERSIONSTR}.lnk" "$BinDir\bin\$TargetEXE"
CreateShortcut "$Desktop\${MYABBREV} ${VERSIONSTR} Examples.lnk" "$DocDir\Scenes"
!insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}" DisplayName "$(^Name) ${VERSIONSTR}"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}" DisplayVersion "${MYVER}"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}" Publisher "${MYCOMPANY}"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}" URLInfoAbout "${MYURL}"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}" DisplayIcon "$BinDir\${MYEXEPREFIX}-${MYVER}-uninstall.exe"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}" UninstallString "$BinDir\${MYEXEPREFIX}-${MYVER}-uninstall.exe"
WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}" NoModify 1
WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}" NoRepair 1
# set up our file association, backing up previous values if present
ClearErrors
ReadRegStr $R0 HKCR ".${MYSCENEEXT}" "backup"
IfErrors +1 +3
ReadRegStr $R0 HKCR ".${MYSCENEEXT}" ""
WriteRegStr HKCR ".${MYSCENEEXT}" "backup" $R0
WriteRegStr HKCR ".${MYSCENEEXT}" "" "${MYABBREV}.Scene"
# we don't save the perceived type as it should always be text
WriteRegStr HKCR ".${MYSCENEEXT}" "PerceivedType" "text"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene" "backup"
IfErrors +1 +3
ReadRegStr $R0 HKCR "${MYABBREV}.Scene" ""
WriteRegStr HKCR "${MYABBREV}.Scene" "backup" $R0
WriteRegStr HKCR "${MYABBREV}.Scene" "" "${MYABBREV} scene source file"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\open" "backup"
IfErrors +1 +3
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\open" ""
WriteRegStr HKCR "${MYABBREV}.Scene\shell\open" "backup" $R0
WriteRegStr HKCR "${MYABBREV}.Scene\shell\open" "" "Edit in ${MYABBREV} ${MYVER}"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\edit" "backup"
IfErrors +1 +3
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\edit" ""
WriteRegStr HKCR "${MYABBREV}.Scene\shell\edit" "backup" $R0
WriteRegStr HKCR "${MYABBREV}.Scene\shell\edit" "" "Render with ${MYABBREV} ${MYVER}"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\DefaultIcon" "backup"
IfErrors +1 +3
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\DefaultIcon" ""
WriteRegStr HKCR "${MYABBREV}.Scene\DefaultIcon" "backup" $R0
WriteRegStr HKCR "${MYABBREV}.Scene\DefaultIcon" "" "$BinDir\bin\${MYABBREV}.Scene-XP.ico"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\open\command" "backup"
IfErrors +1 +3
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\open\command" ""
WriteRegStr HKCR "${MYABBREV}.Scene\shell\open\command" "backup" $R0
WriteRegStr HKCR "${MYABBREV}.Scene\shell\open\command" "" '"$BinDir\bin\$TargetEXE" /edit "%1"'
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\edit\command" "backup"
IfErrors +1 +3
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\edit\command" ""
WriteRegStr HKCR "${MYABBREV}.Scene\shell\edit\command" "backup" $R0
WriteRegStr HKCR "${MYABBREV}.Scene\shell\edit\command" "" '"$BinDir\bin\$TargetEXE" /render "%1"'
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
SectionEnd
# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend
Function isEmptyDir
# Stack -> # Stack: <directory>
Exch $0 # Stack: $0
Push $1 # Stack: $1, $0
FindFirst $0 $1 "$0\*.*"
strcmp $1 "." 0 _notempty
FindNext $0 $1
strcmp $1 ".." 0 _notempty
ClearErrors
FindNext $0 $1
IfErrors 0 _notempty
FindClose $0
Pop $1 # Stack: $0
StrCpy $0 1
Exch $0 # Stack: 1 (true)
goto _end
_notempty:
FindClose $0
ClearErrors
Pop $1 # Stack: $0
StrCpy $0 0
Exch $0 # Stack: 0 (false)
_end:
FunctionEnd
Function BinDirectoryLeave
IfFileExists "$BinDir\*.*" 0 exit
push $BinDir
Call isEmptyDir
Pop $0
StrCmp $0 0 0 exit
MessageBox MB_YESNO|MB_ICONEXCLAMATION "The destination folder is not empty.$\r$\nWould you like to use it anyway?" IDYES exit
Abort
exit:
FunctionEnd
Function DocDirectoryLeave
IfFileExists "$DocDir\*.*" 0 exit
push $DocDir
Call isEmptyDir
Pop $0
StrCmp $0 0 0 exit
MessageBox MB_YESNO|MB_ICONEXCLAMATION "The destination folder is not empty.$\r$\nWould you like to use it anyway?" IDYES exit
Abort
exit:
FunctionEnd
Function ReadyToInstall
!insertmacro MUI_HEADER_TEXT "Ready to Install" "Press Install to begin the installation."
nsDialogs::Create 1018
Pop $Dialog
nsDialogs::Show
FunctionEnd
# Uninstaller sections
Section /o "-un.User Files" UNSEC0001
DeleteRegValue HKCU "${REGKEY}\Components" "User Files"
SectionEnd
Section /o -un.Main UNSEC0000
RmDir /r $INSTDIR\bin
RmDir /r $INSTDIR\help
RmDir /r $INSTDIR\sounds
RmDir /r $INSTDIR\tiles
Delete $INSTDIR\changes.txt
Delete $INSTDIR\revision.txt
Delete $INSTDIR\agpl-3.0.txt
RmDir $INSTDIR
DeleteRegValue HKCU "${REGKEY}\Components" Main
SectionEnd
Section -un.post UNSEC0002
DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}"
DeleteRegKey HKCU "${REGKEY}"
# if our backup value exists, write it to the default value
ClearErrors
ReadRegStr $R0 HKCR ".${MYSCENEEXT}" "backup"
IfErrors +3
WriteRegStr HKCR ".${MYSCENEEXT}" "" $R0
DeleteRegValue HKCR ".${MYSCENEEXT}" "backup"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene" "backup"
IfErrors +3
WriteRegStr HKCR "${MYABBREV}.Scene" "" $R0
DeleteRegValue HKCR "${MYABBREV}.Scene" "backup"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\open" "backup"
IfErrors +3
WriteRegStr HKCR "${MYABBREV}.Scene\shell\open" "" $R0
DeleteRegValue HKCR "${MYABBREV}.Scene\shell\open" "backup"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\edit" "backup"
IfErrors +3
WriteRegStr HKCR "${MYABBREV}.Scene\shell\edit" "" $R0
DeleteRegValue HKCR "${MYABBREV}.Scene\shell\edit" "backup"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\DefaultIcon" "backup"
IfErrors +3
WriteRegStr HKCR "${MYABBREV}.Scene\DefaultIcon" "" $R0
DeleteRegValue HKCR "${MYABBREV}.Scene\DefaultIcon" "backup"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\open\command" "backup"
IfErrors +3
WriteRegStr HKCR "${MYABBREV}.Scene\shell\open\command" "" $R0
DeleteRegValue HKCR "${MYABBREV}.Scene\shell\open\command" "backup"
ClearErrors
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\edit\command" "backup"
IfErrors +3
WriteRegStr HKCR "${MYABBREV}.Scene\shell\edit\command" "" $R0
DeleteRegValue HKCR "${MYABBREV}.Scene\shell\edit\command" "backup"
# if the default value is empty or does not exist, delete the key
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\edit\command" ""
StrCmp $R0 "" +1 +2
DeleteRegKey HKCR "${MYABBREV}.Scene\shell\edit\command"
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\open\command" ""
StrCmp $R0 "" +1 +2
DeleteRegKey HKCR "${MYABBREV}.Scene\shell\open\command"
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\edit" ""
StrCmp $R0 "" +1 +2
DeleteRegKey /ifempty HKCR "${MYABBREV}.Scene\shell\edit"
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\shell\open" ""
StrCmp $R0 "" +1 +2
DeleteRegKey /ifempty HKCR "${MYABBREV}.Scene\shell\open"
ReadRegStr $R0 HKCR "${MYABBREV}.Scene\DefaultIcon" ""
StrCmp $R0 "" +1 +2
DeleteRegKey HKCR "${MYABBREV}.Scene\DefaultIcon"
DeleteRegKey /ifempty HKCR "${MYABBREV}.Scene\shell"
DeleteRegKey /ifempty HKCR "${MYABBREV}.Scene"
ReadRegStr $R0 HKCR ".${MYSCENEEXT}" ""
StrCmp $R0 "" +1 +2
DeleteRegKey HKCR ".${MYSCENEEXT}"
Delete "$SMPROGRAMS\$StartMenuGroup\${MYPRODUCT}.lnk"
Delete "$SMPROGRAMS\$StartMenuGroup\License.lnk"
Delete "$SMPROGRAMS\$StartMenuGroup\Documentation.lnk"
Delete "$SMPROGRAMS\$StartMenuGroup\Release Notes.lnk"
Delete "$SMPROGRAMS\$StartMenuGroup\Change List.lnk"
Delete "$SMPROGRAMS\$StartMenuGroup\Sample Scenes.lnk"
Delete "$SMPROGRAMS\$StartMenuGroup\Scene Previews.lnk"
Delete "$Desktop\${MYABBREV} ${VERSIONSTR}.lnk"
Delete "$Desktop\${MYABBREV} ${VERSIONSTR} Examples.lnk"
Delete $INSTDIR\${MYEXEPREFIX}-${MYVER}-uninstall.exe
RmDir $SMPROGRAMS\$StartMenuGroup
RmDir $INSTDIR
SectionEnd
# Installer functions
Function .onInit
InitPluginsDir
${If} ${RunningX64}
SetRegView 64
${EndIf}
ReadRegStr $R0 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) ${UNINSTALL_REG_SUFFIX}" UninstallString
StrCmp $R0 "" Proceed
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "A copy of $(^Name) is currently installed. Remove it before proceeding?" IDNO Proceed IDYES UninstallRC
Abort
UninstallRC:
ClearErrors
${GetParent} $R0 $R1
ExecWait '$R0 _?=$R1'
Delete $R0
RmDir $R1
Proceed:
${If} ${RunningX64}
StrCpy $INSTDIR "$PROGRAMFILES64\${BINDEST}"
StrCpy $TargetEXE "${MYEXEPREFIX}64.exe"
${Else}
StrCpy $INSTDIR "$PROGRAMFILES\${BINDEST}"
System::Call kernel32::IsProcessorFeaturePresent(i10)i.r0
${If} $0 != 0
StrCpy $TargetEXE "${MYEXEPREFIX}32-sse2.exe"
${Else}
StrCpy $TargetEXE "${MYEXEPREFIX}32.exe"
${EndIf}
${EndIf}
StrCpy $BinDir "$INSTDIR"
StrCpy $DocDir "${DOCDEST}"
FunctionEnd
# Uninstaller functions
Function un.onInit
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
!insertmacro SELECT_UNSECTION "User Files" ${UNSEC0001}
${If} ${RunningX64}
SetRegView 64
${EndIf}
FunctionEnd
|