Skip to content

Commit

Permalink
io.files.unique: add docs for safe-overwrite-file
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed May 28, 2024
1 parent 5d2bbbb commit 3bd5787
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion basis/io/files/unique/unique-docs.factor
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ HELP: safe-replace-file
{ $values { "original-path" "a pathname string" } { "quot" quotation } }
{ $description "Copies the file from " { $snippet "original-path" } " to a unique file, applies the " { $snippet "quot" } " quotation to it, and then moves the unique file back atomically." } ;

HELP: safe-overwrite-file
{ $values { "original-path" "a pathname string" } { "quot" quotation } }
{ $description "Calls the " { $snippet "quot" } " quotation with a unique file, and then when the quotation finishes, replaces the file at " { $snippet "original-path" } " with the unique file, atomically." } ;

ARTICLE: "io.files.unique" "Unique files"
"The " { $vocab-link "io.files.unique" } " vocabulary implements cross-platform unique file creation in a high-level and secure way." $nl
"Creating unique files:"
Expand All @@ -58,6 +62,12 @@ ARTICLE: "io.files.unique" "Unique files"
unique-directory
with-unique-directory
cleanup-unique-directory
} ;
}
"Safely changing files:"
{ $subsections
safe-replace-file
safe-overwrite-file
}
;

ABOUT: "io.files.unique"

0 comments on commit 3bd5787

Please sign in to comment.