NotFoundError if this path does not exist; PathError
(or a subclass) when the underlying move fails.
void replace(string target) constOverwrites target by moving this path over it. On platforms that support it (POSIX), this is an atomic replacement using rename(2).
Platform semantics:
rename(2) which atomically replaces target if it exists.MoveFileExW with MOVEFILE_REPLACE_EXISTING, replacing the destination atomically and never deleting it manually — a failed move leaves the destination untouched.This mirrors Python's pathlib Path.replace() behavior.
target | The destination path to be replaced by this path. |
NotFoundError if this path does not exist; PathError
(or a subclass) when the underlying move fails.