Path.replace
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:
- POSIX: Uses
rename(2)which atomically replacestargetif it exists. - Windows: Tries
std.file.rename; if it fails due to an existing target,
removes the target and retries the rename. This may not be atomic.
This mirrors Python's pathlib Path.replace() behavior.
Parameters
target | The destination path to be replaced by this path. |