-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patheditcp.nsi
More file actions
135 lines (105 loc) · 3.69 KB
/
editcp.nsi
File metadata and controls
135 lines (105 loc) · 3.69 KB
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
; editcp.nsi
;
; This script will install editcp-{VERSION}.exe into a directory that
; the user selects; and optionally installs start menu and desktop shortcuts.
;
;--------------------------------
; The name of the installer
Name "editcp"
Target x86-unicode
; The file to write
OutFile "editcp-${VERSION}-installer.exe"
!include "LogicLib.nsh"
Function .onInit
StrCpy $INSTDIR $PROGRAMFILES32\editcp
; Check for previous (ill-installed) versions
IfFileExists "$PROGRAMFILES32\Dale Farnsworth\editcp 0.4\*.*" 0 CheckV5
MessageBox MB_OK "editcp 0.4 is still installed.$\n\
Please remove it before installing this version."
Abort
CheckV5:
IfFileExists "$PROGRAMFILES32\Dale Farnsworth\editcp 0.5.0\*.*" 0 CheckUninstall
MessageBox MB_OK "editcp 0.5.0 is still installed. \
Please remove it before installing this version."
Abort
CheckUninstall:
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\editcp" "UninstallString"
StrCmp $R0 "" FinishedUninstallChecks
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"editcp is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
ExecWait "$R0 /S"
FinishedUninstallChecks:
FunctionEnd
Section
Setoutpath $INSTDIR
File deploy\win32\editcp.exe
File editcp.ico
File dll\STDFU.dll
File dll\STTubeDevice30.dll
SectionEnd
; The default installation directory
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\editcp" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; The stuff to install
Section "editcp (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\editcp "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\editcp" "DisplayName" "editcp-${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\editcp" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\editcp" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\editcp" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcut"
CreateDirectory "$SMPROGRAMS\editcp"
SetOutPath $DESKTOP
CreateShortCut "$SMPROGRAMS\editcp\EditCp.lnk" "$INSTDIR\editcp.exe" "" "$INSTDIR\editcp.ico" 0
SectionEnd
; Optional section (can be disabled by the user)
Section /o "Desktop Shortcut"
SetOutPath $DESKTOP
CreateShortCut "$DESKTOP\EditCp.lnk" "$INSTDIR\editcp.exe" "" "$INSTDIR\editcp.ico" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\editcp"
DeleteRegKey HKLM SOFTWARE\editcp
; Remove files and uninstaller
Delete "$INSTDIR\editcp.exe"
Delete "$INSTDIR\editcp.ico"
Delete "$INSTDIR\STDFU.dll"
Delete "$INSTDIR\STTubeDevice30.dll"
Delete "$INSTDIR\uninstall.exe"
; Remove shortcuts, if any
Delete "$SMPROGRAMS\editcp\EditCp.lnk"
Delete "$DESKTOP\EditCp.lnk"
; Remove directories used
RMDir /r "$SMPROGRAMS\editcp"
RMDir "$INSTDIR"
RMDir /r "$PROGRAMFILES32\editcp"
SectionEnd