-
Notifications
You must be signed in to change notification settings - Fork 272
/
Copy pathwin32-install.vbs
129 lines (94 loc) · 3.07 KB
/
win32-install.vbs
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
' Script to install geanylua on Windows - tested on Win98 and Win2k
set ws = WScript.CreateObject("WScript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")
sub FailMsg(Msg, FileName)
MsgBox Msg & vbCrLf & FileName & vbCrLf & vbCrLf & "Installation failed.", _
0 , "Installation error"
end sub
function MakeFolder(FolderName)
RetVal=false
if fso.FolderExists(FolderName) then
RetVal=true
else
on error resume next
RetVal= fso.CreateFolder(FolderName) <> vbNull
end if
if not RetVal then FailMsg "Failed to create folder:" , FolderName
MakeFolder=RetVal
end function
function InstallFolder(srcname,trgname)
if not fso.FolderExists(srcname) then
FailMsg "Can't find source folder:'" , srcname
InstallFolder=false
exit function
end if
set src = fso.GetFolder(srcname)
on error resume next
src.Copy(trgname)
RetVal=fso.FolderExists(trgname)
if not RetVal then FailMsg "Failed to create folder:" , trgname
InstallFolder=RetVal
end function
function InstallFile(srcname,trgname)
InstallFile=false
if not fso.FileExists(srcname) then
FailMsg "Can't find install file:" , srcname
exit function
end if
if fso.FileExists(trgname) then
on error resume next
fso.DeleteFile(trgname)
end if
if fso.FileExists(trgname) then
FailMsg "Failed to overwite existing file:" , trgname
exit function
end if
set src = fso.GetFile(srcname)
on error resume next
src.Copy(trgname)
if not fso.FileExists(trgname) then
FailMsg "Failed to create file:" , trgname
exit function
end if
InstallFile=true
end function
sub DoInstall ()
dest = ws.SpecialFolders("AppData")
if not MakeFolder(dest) then exit sub
dest=dest & "\Geany"
if not MakeFolder(dest) then exit sub
dest=dest & "\plugins"
if not MakeFolder(dest) then exit sub
dllname="geanylua.dll"
if fso.FileExists(dllname) then
srcname = dllname
elseif fso.FileExists(".libs\" & dllname) then
srcname = ".libs\" & dllname
else
FailMsg "Can't find install file:" , dllname
exit sub
end if
if not InstallFile(srcname, dest & "\" & dllname) then exit sub
dest=dest & "\geanylua"
if not MakeFolder(dest) then exit sub
libname="libgeanylua.dll"
if fso.FileExists(libname) then
srcname = libname
elseif fso.FileExists(".libs\" & libname) then
srcname = ".libs\" & libname
else
FailMsg "Can't find install file:" , libname
exit sub
end if
if not InstallFile(srcname, dest & "\" & libname) then exit sub
if not InstallFolder("examples", dest & "\examples") then exit sub
if not InstallFolder("docs", dest & "\support") then exit sub
MsgBox "Installation Complete!", 0, "GeanyLua Installation"
end sub
RetVal = MsgBox(" -- This will install GeanyLua for the current user --" & _
vbCrLf & vbCrLf & _
"Be sure to close all running instances of Geany before continuing!" & _
vbCrLf & vbCrLf & _
"Do you wish to continue?", 4, "GeanyLua Installation")
if RetVal = 6 then DoInstall() else _
MsgBox "Installation Cancelled.", 0, "GeanyLua Installation"