feat(status): relative path of obj
This commit is contained in:
@@ -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
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user