Commit dfbd9e6
committed
os-path: implement normpath and fix abspath
normpath was a no-op stub that returned the input unchanged.
This caused abspath to produce un-normalized paths containing
"." and ".." components (e.g. "/cwd/./foo" instead of "/cwd/foo").
Implement normpath following CPython posixpath semantics:
- collapse "." components
- resolve ".." by removing the preceding component
- collapse multiple consecutive slashes
- preserve POSIX double-slash "//" at path start
- return "." for empty input
Update abspath to call normpath on the result.1 parent 8a184c4 commit dfbd9e6
1 file changed
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
13 | 35 | | |
14 | 36 | | |
15 | 37 | | |
16 | | - | |
17 | | - | |
18 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
19 | 41 | | |
20 | 42 | | |
21 | 43 | | |
| |||
0 commit comments