Files
@ a74fb4a40466
Branch filter:
Location: EI/VirtualLeaf/src/VirtualLeaf-install.nsi
a74fb4a40466
3.5 KiB
text/x-nsis
Improved installer script.
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 | # $Id$
# appends \ to the path if missing
# example: !insertmacro GetCleanDir "c:\blabla"
# Pop $0 => "c:\blabla\"
!macro GetCleanDir INPUTDIR
; ATTENTION: USE ON YOUR OWN RISK!
; Please report bugs here: http://stefan.bertels.org/
!define Index_GetCleanDir 'GetCleanDir_Line${__LINE__}'
Push $R0
Push $R1
StrCpy $R0 "${INPUTDIR}"
StrCmp $R0 "" ${Index_GetCleanDir}-finish
StrCpy $R1 "$R0" "" -1
StrCmp "$R1" "\" ${Index_GetCleanDir}-finish
StrCpy $R0 "$R0\"
${Index_GetCleanDir}-finish:
Pop $R1
Exch $R0
!undef Index_GetCleanDir
!macroend
# similar to "RMDIR /r DIRECTORY", but does not remove DIRECTORY itself
# example: !insertmacro RemoveFilesAndSubDirs "$INSTDIR"
!macro RemoveFilesAndSubDirs DIRECTORY
# ATTENTION: USE ON YOUR OWN RISK!
# Please report bugs here: http://stefan.bertels.org/
!define Index_RemoveFilesAndSubDirs 'RemoveFilesAndSubDirs_${__LINE__}'
Push $R0
Push $R1
Push $R2
!insertmacro GetCleanDir "${DIRECTORY}"
Pop $R2
FindFirst $R0 $R1 "$R2*.*"
${Index_RemoveFilesAndSubDirs}-loop:
StrCmp $R1 "" ${Index_RemoveFilesAndSubDirs}-done
StrCmp $R1 "." ${Index_RemoveFilesAndSubDirs}-next
StrCmp $R1 ".." ${Index_RemoveFilesAndSubDirs}-next
IfFileExists "$R2$R1\*.*" ${Index_RemoveFilesAndSubDirs}-directory
; file
Delete "$R2$R1"
goto ${Index_RemoveFilesAndSubDirs}-next
${Index_RemoveFilesAndSubDirs}-directory:
; directory
RMDir /r "$R2$R1"
${Index_RemoveFilesAndSubDirs}-next:
FindNext $R0 $R1
Goto ${Index_RemoveFilesAndSubDirs}-loop
${Index_RemoveFilesAndSubDirs}-done:
FindClose $R0
Pop $R2
Pop $R1
Pop $R0
!undef Index_RemoveFilesAndSubDirs
!macroend
!define PRODUCT_NAME "The Virtual Leaf"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "Center for Mathematics and Computer Science (CWI)"
!define PRODUCT_WEB_SITE "www.cwi.nl"
!define EXECUTABLE "VirtualLeaf.exe"
!define PROGICON "leaficon.ico"
!define SETUP_BITMAP "leaficon.ico"
# MUI 1.67 compatible ------
!include "MUI.nsh"
# MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "leaficon.ico"
!define MUI_UNICON "leaficon.ico"
# Welcome page
!insertmacro MUI_PAGE_WELCOME
# License page
!insertmacro MUI_PAGE_LICENSE "..\doc\GPL"
# Components page
!insertmacro MUI_PAGE_COMPONENTS
# Directory page
!insertmacro MUI_PAGE_DIRECTORY
# Instfiles page
!insertmacro MUI_PAGE_INSTFILES
# Finish page
!insertmacro MUI_PAGE_FINISH
# Uninstaller pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
# Language files
!insertmacro MUI_LANGUAGE "English"
# MUI end ------
# set the name of the installer
outfile "VirtualLeaf-install.exe"
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
ShowInstDetails show
ShowUnInstDetails show
# define the directory to install to
installDir C:\VirtualLeaf
# Request application privileges
RequestExecutionLevel user
section "Virtual Leaf executable"
sectionIn RO
# define the output path for the Virtual Leaf executable
setOutPath $INSTDIR
writeUninstaller $INSTDIR\uninstaller.exe
file ..\bin\VirtualLeaf.exe
sectionEnd
section "Virtual Leaf models"
# define the output path for the Virtual Leaf models
setOutPath $INSTDIR\models
file ..\bin\models\*
sectionEnd
# create a section to define what the uninstaller does.
# the section will always be named "Uninstall"
section "Uninstall"
# Always delete uninstaller first
delete $INSTDIR\uninstaller.exe
# now delete installed file
!insertmacro RemoveFilesAndSubDirs "$INSTDIR"
sectionEnd
# finis
|