io.directories: directory-tree-files should include the directories too, not just their contents
parent
72de727d0e
commit
1632fa6448
|
@ -48,7 +48,7 @@ HELP: directory-files
|
||||||
|
|
||||||
HELP: directory-tree-files
|
HELP: directory-tree-files
|
||||||
{ $values { "path" "a pathname string" } { "seq" "a sequence of filenames" } }
|
{ $values { "path" "a pathname string" } { "seq" "a sequence of filenames" } }
|
||||||
{ $description "Outputs a sequence of all non-directory files inside the directory named by " { $snippet "path" } " and its subdirectories." } ;
|
{ $description "Outputs a sequence of all files and subdirectories inside the directory named by " { $snippet "path" } " or recursively inside its subdirectories." } ;
|
||||||
|
|
||||||
HELP: with-directory-files
|
HELP: with-directory-files
|
||||||
{ $values { "path" "a pathname string" } { "quot" quotation } }
|
{ $values { "path" "a pathname string" } { "quot" quotation } }
|
||||||
|
|
|
@ -28,6 +28,12 @@ IN: io.directories.tests
|
||||||
] with-directory
|
] with-directory
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
[ { "classes/tuple" } ] [
|
||||||
|
"resource:core" [
|
||||||
|
"." directory-tree-files [ "classes/tuple" = ] filter
|
||||||
|
] with-directory
|
||||||
|
] unit-test
|
||||||
|
|
||||||
[ { "classes/tuple/tuple.factor" } ] [
|
[ { "classes/tuple/tuple.factor" } ] [
|
||||||
"resource:core" [
|
"resource:core" [
|
||||||
[ "classes/tuple/tuple.factor" = ] filter
|
[ "classes/tuple/tuple.factor" = ] filter
|
||||||
|
|
|
@ -45,8 +45,11 @@ HOOK: (directory-entries) os ( path -- seq )
|
||||||
dup directory-entries
|
dup directory-entries
|
||||||
[
|
[
|
||||||
dup type>> +directory+ =
|
dup type>> +directory+ =
|
||||||
[ name>> [ append-path directory-tree-files ] [ [ prepend-path ] curry map ] bi ]
|
[ name>>
|
||||||
[ nip name>> 1array ] if
|
[ append-path directory-tree-files ]
|
||||||
|
[ [ prepend-path ] curry map ]
|
||||||
|
[ prefix ] tri
|
||||||
|
] [ nip name>> 1array ] if
|
||||||
] with map concat ;
|
] with map concat ;
|
||||||
|
|
||||||
: with-directory-entries ( path quot -- )
|
: with-directory-entries ( path quot -- )
|
||||||
|
|
Loading…
Reference in New Issue