blob: 8c9e022d5ecd497916005bb78e401de13ac1315c (
about) (
plain) (
blame)
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
|
# Default classes file
# Compatibility only: do not use.
# Use /addon.installfiles instead.
# A helper class for installing files and generating an uninstallation alias on the fly
class(installer,object)
{
constructor()
{
$$->%iNumFiles = 0
}
copyFiles($0 = source dir, $1 = file regexp, $2 = target dir)
{
if($0 == "")
{
echo $tr("[Installer] Error: the first argument of copyFiles must be a source directory","defscript")
halt
}
if($1 == "")
{
echo $tr("[Installer] Error: the second argument of copyFiles must be a file name or file regexp","defscript")
halt
}
if($2 == "")
{
echo $tr("[Installer] Error: the third argument of copyFiles must be a destination directory","defscript")
halt
}
if($file.exists($0))
{
%files[] = $file.ls($0,f,$1)
if($length(%files[]))
{
file.mkdir $2
foreach(%file,%files[])
{
$$->%lFiles[$$->%iNumFiles] = $str.replace($file.fixpath("$2/%file"),"\\\\","\\")
$$->%iNumFiles++;
file.copy -o "$0/%file" "$2/%file"
}
}
}
}
generateUninstallAlias($0 = alias name)
{
%c = "alias($0)$lf"
%c .= "{$lf"
if($$->%iNumFiles > 0)
{
foreach(%file,$$->%lFiles[])
{
%c .= "file.remove \"%file\"$lf";
}
}
%c .= "}"
eval %c
}
};
|