io.directories.search: some cleanup.

db4
John Benediktsson 2014-05-20 14:46:01 -07:00
parent 3fb1532bd6
commit ab969b072c
2 changed files with 3 additions and 6 deletions

View File

@ -46,7 +46,7 @@ HELP: find-in-directories
HELP: find-all-files
{ $values
{ "path" "a pathname string" } { "quot" quotation }
{ "paths/f" "a sequence of pathname strings or f" }
{ "paths" "a sequence of pathname strings" }
}
{ $description "Recursively finds all files in the input directory matching the predicate quotation." } ;

View File

@ -100,14 +100,11 @@ ERROR: file-not-found path bfs? quot ;
: directory-size ( path -- n )
0 swap t [ link-size/0 + ] each-file ;
: path>usage ( directory-entry -- name size )
[ name>> dup ] [ directory? ] bi
[ directory-size ] [ link-size/0 ] if ;
: directory-usage ( path -- assoc )
[
[
[ path>usage ] [ drop name>> 0 ] recover
[ name>> dup ] [ directory? ] bi
[ directory-size ] [ link-size/0 ] if
] { } map>assoc
] with-qualified-directory-entries sort-values ;