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
// module/core/pth/src/lib.rs
use mod_interface;
// qqq: xxx: implement `pth ::absolute ::join` function or add option to `pth ::path ::join`
// Desired Signature Idea 1 : `pub fn join< T1, T2 >(p1: T1, p2: T2) -> io ::Result< AbsolutePath >` (extendable for more args or tuples)
// Desired Signature Idea 2 : `pub fn join< Paths: PathJoined >(paths: Paths, options: JoinOptions) -> io ::Result< AbsolutePath >` where JoinOptions includes absolute handling.
// Behavior :
// 1. Takes multiple path-like items (e.g., via tuple, slice, or multiple args).
// 2. Finds the rightmost item that represents an absolute path.
// 3. If an absolute path is found, it joins all path segments *from that absolute path onwards*.
// 4. If *no* absolute path is found, it joins *all* segments relative to the current working directory (implicitly using `CurrentPath` if needed).
// 5. The final joined path must be canonicalized and returned as an `AbsolutePath`.
// 6. Return an `io ::Error` if input is invalid or joining/canonicalization fails.
// Examples (assuming CurrentPath resolves relative paths) :
// - `pth ::absolute ::join("/abs/a", "rel/b")` -> `Ok(AbsolutePath ::from("/abs/a/rel/b"))`
// - `pth ::absolute ::join("rel/a", "/abs/b", "rel/c")` -> `Ok(AbsolutePath ::from("/abs/b/rel/c"))`
// - `pth ::absolute ::join("rel/a", "/abs/b", "/abs/c", "rel/d")` -> `Ok(AbsolutePath ::from("/abs/c/rel/d"))`
// - `pth ::absolute ::join("rel/a", "rel/b")` -> `Ok(AbsolutePath ::from(current_dir.join("rel/a/rel/b")))`
// - `pth ::absolute ::join("/abs/a/..", "b")` -> `Ok(AbsolutePath ::from("/b"))`
/// Own namespace of the module. Contains items public within this layer, but not propagated.
mod_interface!