install_released_files.anubis
2.44 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
Installing the library files for the next realease.
This file is not part of the distribution.
read official_library.anubis
define String
copy_command
=
if host_system is
{
beos then "cp",
linux then "cp",
windows then "copy"
}.
define String
source_dir
=
if host_system is
{
beos then alert,
linux then "/home/alp/anubis_dev/library/",
windows then ".\\"
}
define String
dest_dir
=
if host_system is
{
beos then alert,
linux then "/home/alp/anubis_distrib/library/",
windows then "C:\\Anubis_dev\\anubis_distrib\\library\\"
}.
define Bool
is_mask // test if a file path is a file mask (contains a '*')
(
String path,
Int i
) =
if nth(i,path) is
{
failure then false,
success(c) then
if c = '*'
then true
else is_mask(path,i+1)
}.
define Bool
file_exists // check is a file exists
(
String path
) =
if is_mask(path,0) then alert else // 'path' must not be a mask
if file(path,read) is
{
failure then false,
success(_) then true
}.
define One
copy_one_file // copy a single file
(
String file_path // relative to 'library/'
) =
if is_mask(file_path,0) then alert else // must not be a mask
//
// Check if the file exists
//
(if file_exists(source_dir + file_path)
then unique
else print("File '"+file_path+"' does not exist.\n"));
//
// Copy the file
//
if execute(copy_command,
[
source_dir + file_path,
dest_dir + file_path
]) is
{
failure then print("Cannot copy file '"+file_path+"'.\n"),
success(n) then
if n = 0
then unique
else print("Problem while copying file '"+file_path+"'.\n")
}.
define One
do_for_one_path
(
String path
) =
if is_mask(path,0)
then (if split_path(path) is (path_part,mask_part) then
map_forget(copy_one_file,directory_list(source_dir+path_part,mask_part)))
else copy_one_file(path).
global define One
install_released_files
(
List(String) args
) =