Handbook
Glossary
safe-overwrite-file ( ..a original-path quot: ( ..a empty-path -- ..b ) -- ..b )
Unique files
Prev:
safe-replace-file ( ..a original-path quot: ( ..a copy-path -- ..b ) -- ..b )
Vocabulary
io
.
files
.
unique
Inputs
original-path
a pathname string
quot
a
quotation
Outputs
None
Word description
Calls the
quot
quotation with a unique file, and then when the quotation finishes, replaces the file at
original-path
with the unique file, atomically.
Definition
USING:
io.directories
kernel
;
IN:
io.files.unique
:
safe-overwrite-file
( ..a original-path quot: ( ..a empty-path -- ..b ) -- ..b )
[
""
""
]
dip
[
[
nip
]
]
dip
compose
[
[
swap
move-file-atomically
]
2bi
]
curry
cleanup-unique-file
;
inline