File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
crates/lune-std/src/require Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -46,14 +46,10 @@ pub(crate) fn relative_path_normalize(path: &Path) -> PathBuf {
46
46
number of times, and represent parent folders without first canonicalizing paths.
47
47
*/
48
48
pub ( crate ) fn relative_path_parent ( rel : & mut PathBuf ) {
49
- // If our relative path becomes empty, we should keep traversing it,
50
- // but we need to do so by appending the special "parent dir" component,
51
- // which is normally represented by ".."
52
- if rel. components ( ) . count ( ) == 1 && rel. components ( ) . next ( ) . unwrap ( ) == Component :: CurDir {
53
- rel. pop ( ) ;
54
- rel. push ( Component :: ParentDir ) ;
55
- } else if rel. components ( ) . all ( |c| matches ! ( c, Component :: ParentDir ) ) {
56
- rel. push ( Component :: ParentDir ) ;
49
+ if rel. as_os_str ( ) == Component :: CurDir . as_os_str ( ) {
50
+ * rel = PathBuf :: from ( Component :: ParentDir . as_os_str ( ) ) ;
51
+ } else if rel. components ( ) . all ( |c| c == Component :: ParentDir ) {
52
+ rel. push ( Component :: ParentDir . as_os_str ( ) ) ;
57
53
} else {
58
54
rel. pop ( ) ;
59
55
}
You can’t perform that action at this time.
0 commit comments