{ unique-file cleanup-unique-file } related-words
HELP: cleanup-unique-file
-{ $values { "prefix" string } { "suffix" string } { "quot" { $quotation ( path -- ) } } }
+{ $values { "prefix" string } { "suffix" string } { "quot" { $quotation ( ..a path -- ..b ) } } }
{ $description "Creates a file with " { $link unique-file } " and calls the quotation with the path name on the stack." }
{ $notes "The unique file will be deleted after calling this word, even if an error is thrown in the quotation." } ;
dup touch-unique-file
] unique-retries get retry absolute-path ;
-:: cleanup-unique-file ( prefix suffix quot: ( path -- ) -- )
+:: cleanup-unique-file ( ..a prefix suffix quot: ( ..a path -- ..b ) -- ..b )
prefix suffix unique-file :> path
[ path quot call ] [ path delete-file ] [ ] cleanup ; inline