move-file-atomically ( from to -- ) (original) (raw)

move-file-atomically ( from to -- )

Vocabulary
io.directories

Inputs

from a pathname string
to a pathname string

Outputs
None

Word description
Moves or renames a file as an atomic operation.

Errors
Throws an error if the file does not exist or if the move operation fails.

Definition

USING: io.backend ;

IN: io.directories

HOOK: move-file-atomically io-backend ( from to -- )

Methods

USING: io.backend io.directories kernel system unix unix.ffi ;

M: unix move-file-atomically
[ normalize-path ] bi@ [ rename ] unix-system-call drop ;