forked from fchat-pidgin/fchat-pidgin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflist.nsi
118 lines (93 loc) · 3.34 KB
/
flist.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
; Script based on the Facebookchat, Skype4Pidgin and Off-the-Record Messaging NSI files
SetCompress off
; todo: SetBrandingImage
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "fchat-pidgin"
#!define PRODUCT_VERSION "0.4.0"
!define PRODUCT_PUBLISHER "Nelwill, Sabhak, Syldra Kitty"
!define PRODUCT_WEB_SITE "http://github.com/fchat-pidgin/fchat-pidgin"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page misused to display README
!define MUI_PAGE_HEADER_TEXT "Readme"
!define MUI_PAGE_HEADER_SUBTEXT "Read below for more information about the plugin."
!define MUI_LICENSEPAGE_TEXT_TOP "Press Page Down to see the rest of the readme."
!define MUI_LICENSEPAGE_TEXT_BOTTOM "Thanks for reading!"
!define MUI_LICENSEPAGE_BUTTON "&Next >"
!insertmacro MUI_PAGE_LICENSE "README_USERS"
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckPidginDirReg
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Run Pidgin"
!define MUI_FINISHPAGE_RUN_FUNCTION "RunPidgin"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
;!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}-setup.exe"
Var "PidginDir"
ShowInstDetails show
ShowUnInstDetails show
;
Section "MainSection" SEC01
; If PidginDir was not auto detected, use the manually set path
StrCmp "$PidginDir" "" 0 check
StrCpy $PidginDir $INSTDIR
check:
IfFileExists "$PidginDir\plugins" install
MessageBox MB_OK|MB_ICONINFORMATION "Failed to find Pidgin installation."
Abort "The provided folder does not contains a 'plugins' subdirectory"
install:
SetOverwrite try
SetOutPath "$PidginDir\pixmaps\pidgin"
File "/oname=protocols\16\flist.png" "icons/flist16.png"
File "/oname=protocols\22\flist.png" "icons/flist22.png"
File "/oname=protocols\48\flist.png" "icons/flist48.png"
SetOutPath "$PidginDir\"
File "libjson-glib-1.0.dll"
SetOverwrite try
copy:
ClearErrors
Delete "$PidginDir\plugins\libflist.dll"
IfErrors dllbusy
SetOutPath "$PidginDir\plugins"
File "libflist.dll"
Goto after_copy
dllbusy:
MessageBox MB_RETRYCANCEL "libflist.dll is busy. Please close Pidgin (including tray icon) and try again" IDCANCEL cancel
Goto copy
cancel:
Abort "Installation of flist-pidgin aborted"
after_copy:
SectionEnd
Function CheckPidginDirReg
Push $0
ReadRegStr $0 HKLM "Software\pidgin" ""
IfFileExists "$0\pidgin.exe" cont
ReadRegStr $0 HKCU "Software\pidgin" ""
IfFileExists "$0\pidgin.exe" cont
Return
cont:
StrCpy $PidginDir $0
Abort
FunctionEnd
Function RunPidgin
IfFileExists "$PidginDir\pidgin.exe" run
MessageBox MB_OK|MB_ICONINFORMATION "Could not find pidgin.exe, pleast start Pidgin manually."
Return
run:
ExecShell "" "$PidginDir\pidgin.exe"
FunctionEnd