 
 : path-separator ( -- string ) os windows? "\\" "/" ? ;
 
-: right-trim-separators ( str -- newstr )
-    [ path-separator? ] right-trim ;
-
-: left-trim-separators ( str -- newstr )
-    [ path-separator? ] left-trim ;
+: trim-right-separators ( str -- newstr )
+    [ path-separator? ] trim-right ;
+
+: trim-left-separators ( str -- newstr )
+    [ path-separator? ] trim-left ;
 
 : last-path-separator ( path -- n ? )
     [ length 1- ] keep [ path-separator? ] find-last-from ;

: append-path-empty ( path1 path2 -- path' )
    {
        { [ dup head.? ] [
            rest left-trim-separators append-path-empty
        ] }
        { [ dup head..? ] [ drop no-parent-directory ] }
        [ nip ]


: parent-directory ( path -- parent )
    dup root-directory? [
        trim-right-separators
        dup last-path-separator [
            1+ cut
        ] [
