notes/personal/tech/Understanding how to handle paths for Ash.md
2023-08-26 11:36:11 -06:00

552 B

#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