pub fn last_parent_dir<S: AsRef<str>>(parts: &[S]) -> Option<usize>Expand description
The index of the last .. among a path’s parts, if there is one.
music21’s cleanpath collapses a .. only where the folders up to and
including the last one exist, so this is how far it has to look.
use music21::common::pathtools::last_parent_dir;
assert_eq!(last_parent_dir(&["/", "a", "..", "b", "..", "c"]), Some(4));
assert_eq!(last_parent_dir(&["a", "b"]), None);