diff --git a/basis/io/files/unique/unique.factor b/basis/io/files/unique/unique.factor index 9ab84bb262..77d5628b15 100644 --- a/basis/io/files/unique/unique.factor +++ b/basis/io/files/unique/unique.factor @@ -36,10 +36,22 @@ PRIVATE> dup touch-unique-file ] unique-retries get retry absolute-path ; +: unique-files ( prefix suffixes -- paths ) + '[ + _ _ [ + random-file-name glue + dup touch-unique-file + ] with map + ] unique-retries get retry [ absolute-path ] map ; + :: cleanup-unique-file ( ..a prefix suffix quot: ( ..a path -- ..b ) -- ..b ) prefix suffix unique-file :> path [ path quot call ] [ path delete-file ] [ ] cleanup ; inline +:: cleanup-unique-files ( ..a prefix suffixes quot: ( ..a path -- ..b ) -- ..b ) + prefix suffixes unique-files :> paths + [ paths quot call ] [ paths [ delete-file ] each ] [ ] cleanup ; inline + : unique-directory ( -- path ) [ random-file-name