[ queue>> swap '[ _ _ [ push-front ] [ push-back ] if ] each ] bi ;
: <directory-iterator> ( path bfs? -- iter )
+ [ pathname> ] dip
<dlist> directory-iterator boa
dup path>> over push-directory-entries ;
PRIVATE>
+TUPLE: pathname string ;
+
+C: <pathname> pathname
+
+: >pathname ( obj -- pathname )
+ dup pathname? [ <pathname> ] unless ;
+
+: pathname> ( pathname -- obj )
+ dup pathname? [ string>> ] when ;
+
: absolute-path? ( path -- ? )
{
{ [ dup empty? ] [ drop f ] }
[ trim-head-separators ] bi* "/" glue ;
: append-path ( path1 path2 -- path )
+ [ pathname> ] bi@
{
{ [ over empty? ] [ append-path-empty ] }
{ [ dup empty? ] [ drop ] }
: >windows-path ( path -- path' ) H{ { CHAR: / CHAR: \\ } } substitute ;
-TUPLE: pathname string ;
-
-C: <pathname> pathname
-
M: pathname absolute-path string>> absolute-path ;
M: pathname <=> [ string>> ] compare ;
-
-: >pathname ( obj -- pathname )
- dup pathname? [ <pathname> ] unless ;