Skip to main content

replace_file

Function replace_file 

Source
pub fn replace_file(from: &Path, to: &Path) -> Result<()>
Expand description

Replace to by renaming from to to.

Notes:

  • On Unix, rename overwrites atomically when from and to are on the same filesystem.
  • On Windows, rename fails when to exists. We fall back to remove + rename, which is not atomic but matches the expected overwrite behavior for temp-file workflows.