notes/personal/tech/Understanding how to handle paths for Ash.md

13 lines
552 B
Markdown
Raw Permalink Normal View History

2022-12-20 02:39:18 +00:00
#notes #programming #rust
Absolute paths function as intended
`cd .` takes you to the bianary location
#### Relative Paths
- Paths that are relative can be appended to the current dir
- `..` should strip the directory before it from the path
- `.` can be entirely removed from the absolute path and the endpoint will not be changed
### The Solution:
As it turns out, both Windows and Unix have prebuilt functions that handle cleaning up paths, that are implemented under `std::fs::canonicalize` https://doc.rust-lang.org/std/fs/fn.canonicalize.html