forked from cwoac/TTS-Manager
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.nsi
89 lines (60 loc) · 2.35 KB
/
install.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
!include "MUI2.nsh"
# name the installer
!define VERSION "v0.4.3"
Name "TTS Manager ${VERSION}"
OutFile "Setup TTS Manager ${VERSION}.exe"
InstallDir "$LOCALAPPDATA\TTS Manager"
InstallDirRegKey HKCU "Software\TTS Manager" ""
; up execution level if needs be
RequestExecutionLevel user
Var StartMenuFolder
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_LICENSE LICENSE
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\TTS Manager"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Launch TTS Manager"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme.txt
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "TTS Manager" SecBase
SetOutPath "$INSTDIR"
File /r dist\*
File /oname=readme.txt README.md
File /oname=license.txt LICENSE
WriteRegStr HKCU "Software\TTS Manager" "" $INSTDIR
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\TTS Manager.lnk" $INSTDIR\tts_gui.exe"
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
LangString DESC_SecBase ${LANG_ENGLISH} "TTS Manager (required)."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecBase} $(DESC_SecBase)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
DeleteRegKey /ifempty HKCU "Software\TTS Manager"
SectionEnd
Function LaunchLink
ExecShell "" "$SMPROGRAMS\$StartMenuFolder\TTS Manager.lnk"
FunctionEnd