feat(status): relative path of obj

This commit is contained in:
grimhilt
2024-09-11 23:36:29 +02:00
parent e66dc8d408
commit 8f636b4bf7
6 changed files with 107 additions and 24 deletions

View File

@@ -16,6 +16,15 @@ pub fn to_string(path: &PathBuf) -> String {
path.to_str().unwrap().to_string()
}
pub fn get_level(path: &PathBuf) -> i32 {
let mut level = 0;
let mut path = path.clone();
while path.pop() {
level += 1;
}
level
}
/// Improve the path to try remove and solve .. token.
/// Taken from https://stackoverflow.com/questions/68231306/stdfscanonicalize-for-files-that-dont-exist
///