{ $description "Deletes a file." }
{ $errors "Throws an error if the file could not be deleted." } ;
+HELP: ?delete-file
+{ $values { "path" "a pathname string" } }
+{ $description "Calls " { $link delete-file } " if the " { $snippet "path" } " file exists." } ;
+
HELP: make-directory
{ $values { "path" "a pathname string" } }
{ $description "Creates a directory." }
{ $errors "Throws an error if the file does not exist or if the move operation fails." }
{ $see-also move-file-atomically } ;
+HELP: ?move-file
+{ $values { "from" "a pathname string" } { "to" "a pathname string" } }
+{ $description "Calls " { $link move-file } " if the " { $snippet "from" } " file exists." } ;
+
HELP: move-file-atomically
{ $values { "from" "a pathname string" } { "to" "a pathname string" } }
{ $description "Moves or renames a file as an atomic operation." }
HOOK: move-file io-backend ( from to -- )
+: ?move-file ( from to -- )
+ over file-exists? [ move-file ] [ 2drop ] if ;
+
HOOK: move-file-atomically io-backend ( from to -- )
: move-file-into ( from to -- )
: delete-oldest ( service -- )
keep-logs log# ?delete-file ;
-: ?move-file ( old new -- )
- over file-exists? [ move-file ] [ 2drop ] if ;
-
: advance-log ( path n -- )
[ 1 - log# ] 2keep log# ?move-file ;