fs
fs copied to clipboard
How to clean up paths? Remove `./` etc.
Hi maybe I am missing something, I am just seeking some guidance. How would I clean up this path? It is still working and valid but I don't like it:
fs::path("some/path", "./file.txt")
some/path/./file.txt
Desired output:
some/path/file.txt
I would look at the path_*() functions:
❯ fs::path_
fs::path_abs fs::path_ext_set fs::path_package
fs::path_common fs::path_file fs::path_real
fs::path_dir fs::path_filter fs::path_rel
fs::path_expand fs::path_has_parent fs::path_sanitize
fs::path_expand_r fs::path_home fs::path_split
fs::path_ext fs::path_home_r fs::path_temp
fs::path_ext<- fs::path_join fs::path_tidy
fs::path_ext_remove fs::path_norm fs::path_wd
path_norm() or path_tidy() look promising.
Seemingly path_norm() does this.