blob: f72397de8e7b292b2a3afef6e47f15a594f762ca (
plain)
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
|
# Path type
struct Path {
box.List strings
}
uint8 PATH_SEP = '/'
~uint8 PARENT_DIR = "..\0"
~uint8 CURRENT_DIR = ".\0"
/; method Path
/; init
self.strings.init(8)
;/
/; from_cstr (~uint8 path)
;/
/; to_cstr [~uint8]
box.List out
out.from_cstr("\0")
/; if (self.strings.count < 1)
return out.as_cstr()
;/
~uint8 str = self.strings.get(0)
out.push_cstr(str)
/; loop (int i = 1; i < self.strings.count) [i++]
out.push(~PATH_SEP)
out.push_cstr(str)
;/
return out.as_cstr()
;/
/; relative (~uint8 path) [Path]
;/
/; end
~~uint8 str
/; loop (int i = 0; i < self.strings.count) [i++]
str = self.strings.get(i)
_delete(str`)
;/
self.strings.end()
;/
;/
|