io.directories.search: some cleanup.
parent
3fb1532bd6
commit
ab969b072c
|
|
@ -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." } ;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue