forked from RenderHeads/MayaPlugin-UVAutoRatio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InstallScript.nsi
153 lines (121 loc) · 5.1 KB
/
InstallScript.nsi
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
; Installation Script (C) 2007-2014 RenderHeads Ltd. All Rights Reserved.
; ________________________________________________________________________
!define PRODUCTNAME "UVAutoRatio 2.0 Pro" ; This is the parent product name
!define SHORTPRODUCTNAME "UVAutoRatio2Pro" ; This is the parent product name
!define VERSIONNAME "UVAutoRatio 2.6.0 Pro" ; All subversion (2.1 etc) go here
!define COMPANY "RenderHeads"
!define PRODUCTTYPE "Maya Plugin"
!define VERSION "2.0 Pro"
!define SHORTVERSION "2.6.0"
!define INSTALLDATA "InstallData" ; Folder where data used for installation is kept
SetCompressor /Solid lzma
Name "${VERSIONNAME}"
Caption "${VERSIONNAME} - ${PRODUCTTYPE}"
;OutFile "Releases\${VERSIONNAME} Install.exe"
OutFile "Releases\UVAutoRatioPro-${SHORTVERSION}-Setup.exe"
Icon "${InstallData}\icon.ico"
XPStyle on
InstallDir "$PROGRAMFILES\${COMPANY}\${PRODUCTNAME}"
; _____________________________
; Install Pages
;
PageEx license
Caption " - License Agreement"
LicenseText "License Agreement"
LicenseData "${InstallData}\LicenseAgreement.rtf"
PageExEnd
PageEx directory
Caption " - Select Install Path"
DirVar $INSTDIR
DirText "Select the path where you'd like to install the plugin" "Install Path" "Browse" "Browse"
PageCallbacks "" "" CheckMayaRunning
PageExEnd
PageEx instfiles
Caption " - Installing"
PageExEnd
PageEx license
Caption " - Read Instructions"
LicenseText "Launch Instructions"
LicenseData "${InstallData}\FinalMessage.rtf"
PageExEnd
;Function validateMayaFolder
; IfFileExists $MAYA_DIR\bin\maya.exe PathGood
; MessageBox MB_OK "This doesn't appear to be a valid Maya installation folder. It should look something like this: 'C:\Program Files\Autodesk\Maya2008'."
; Abort
; PathGood:
; call CheckMayaRunning
;FunctionEnd
Function CheckMayaRunning
FindProcDLL::FindProc "maya.exe"
StrCmp $R0 "1" found not_found
found:
MessageBox MB_OK "Please close Maya before running this installation"
Abort
not_found:
FunctionEnd
; _____________________________
; Maya Module Operations
;
Section "Maya Module"
; Copy the module file into the Maya\modules folder
;SetOutPath $MAYA_DIR\modules
;SetOutPath $DOCUMENTS\maya\modules
;File "module\${SHORTPRODUCTNAME}WindowsModule.txt"
; Append the module installation path to the file
ClearErrors
;FileOpen $0 $MAYA_DIR\modules\${SHORTPRODUCTNAME}WindowsModule.txt a
CreateDirectory $DOCUMENTS\maya\modules
FileOpen $0 $DOCUMENTS\maya\modules\${SHORTPRODUCTNAME}Module.txt w
IfErrors done
FileSeek $0 0 END
FileWrite $0 "+ ${SHORTPRODUCTNAME} "
FileWrite $0 "${SHORTVERSION} "
FileWrite $0 $INSTDIR
FileClose $0
done:
SectionEnd
; ____________________________
; Program Files Operations
;
Section "Plugin Files"
SetOutPath $INSTDIR
File /r /x *.bundle /x *.so /x *.svn /x thumbs.db /x *.tga /x *.exe /x *.bat module\*.*
SectionEnd
; _____________________________
; Registry Operations
;
Section "Registry"
WriteRegStr HKLM "Software\${COMPANY}\${PRODUCTNAME}" "InstallPath" $INSTDIR
;WriteRegStr HKLM "Software\${COMPANY}\${PRODUCTNAME}" "MayaPath" $MAYA_DIR
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANY}\${PRODUCTNAME}" "DisplayName" "${PRODUCTNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANY}\${PRODUCTNAME}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANY}\${PRODUCTNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANY}\${PRODUCTNAME}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
CreateDirectory "$APPDATA\RenderHeads\${PRODUCTNAME}"
CreateDirectory "$SMPROGRAMS\RenderHeads\${PRODUCTNAME}"
createShortCut "$SMPROGRAMS\RenderHeads\${PRODUCTNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
createShortCut "$SMPROGRAMS\RenderHeads\${PRODUCTNAME}\Documentation.lnk" "$INSTDIR\docs\manual\index.html"
SectionEnd
; _______________________
; Uninstall
;
UninstPage uninstConfirm
UninstPage instfiles
UninstallIcon "installdata\icon.ico"
Section "Uninstall"
; remove maya module file
ReadRegStr $0 HKLM "Software\${COMPANY}\${PRODUCTNAME}" "MayaPath"
;Delete "$0\modules\${SHORTPRODUCTNAME}WindowsModule.txt"
Delete "$DOCUMENTS\maya\modules\${SHORTPRODUCTNAME}Module.txt"
; remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANY}\${PRODUCTNAME}"
DeleteRegKey HKLM "Software\${COMPANY}\${PRODUCTNAME}"
; remove files
RMDir /r "$INSTDIR"
; remove the links from the start menu
RMDir /r "$SMPROGRAMS\RenderHeads\${PRODUCTNAME}"
; remove the company folder only if empty
RMDir "$SMPROGRAMS\RenderHeads"
SectionEnd