pub fn write_replacing(
final_path: impl AsRef<Path>,
write: impl FnOnce(&mut File) -> Result<(), String>,
) -> Result<(), EncodeError>Expand description
Writes a whole file at final_path, replacing a regular file there only
once write has written all of it: write fills the claimed partial file
beside it (the same claim and lock a video output takes), which is synced
and renamed into place. Any failure removes the partial and leaves what was
at final_path. Only a regular file is replaced; anything else there is
refused before anything is written (and again just before the rename, as
it may have changed meanwhile; what changes between that look and the
rename is not guarded against, as the caller chose the path).
ยงErrors
When final_path names something other than a regular file, its partial
is held by a live export (PARTIAL_OUTPUT_IN_USE), write fails, or
the file system refuses.