File: path.md

package info (click to toggle)
ocaml-eio 1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,548 kB
  • sloc: ml: 14,608; ansic: 1,237; makefile: 25
file content (58 lines) | stat: -rw-r--r-- 878 bytes parent folder | download
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
```ocaml
# #require "eio_posix"
```
```ocaml
module P = Eio_posix__Path

let dump f p =
  Fmt.pf f "%a (%S)" P.dump p (P.to_string p)
```

```ocaml
# #install_printer dump;;

# P.parse "foo"
- : P.t = "foo" ("foo")

# P.parse "foo/bar"
- : P.t = "foo" / "bar" ("foo/bar")

# P.parse "foo//bar/"
- : P.t = "foo" / "bar" / ("foo/bar/")

# P.parse "foo/."
- : P.t = "foo" / ("foo/")

# P.parse "foo/./"
- : P.t = "foo" / ("foo/")

# P.parse ""
- : P.t = . (".")

# P.parse "."
- : P.t = . (".")

# P.parse ".."
- : P.t = .. / . ("..")

# P.parse "./../.././.."
- : P.t = .. / .. / .. / . ("../../..")

# P.parse "/"
- : P.t = / . ("/")

# P.parse "/etc"
- : P.t = / "etc" ("/etc")

# P.parse "/etc/passwd"
- : P.t = / "etc" / "passwd" ("/etc/passwd")

# P.parse "/."
- : P.t = / . ("/")

# P.parse "/.."
- : P.t = / .. / . ("/..")

# P.parse "//../"
- : P.t = / .. / . ("/..")
```