Skip to main content

move_file

Function move_file 

Source
pub fn move_file(src: &Path, dst: &Path) -> Result<()>
Expand description

Move src to dst, creating dst’s parent directory first. Used by M-SAVE.1’s MP4 export path to promote the finalized scratch file into the user’s chosen folder.

Tries an atomic std::fs::rename first — fast and the common case, since the scratch dir and the default output dir are normally on the same (home) volume. Rename fails across volumes (EXDEV) — e.g. exporting to an external drive — so on any rename error it falls back to copy-then-remove, which works across devices.

§Errors

Returns the underlying std::io::Error when the parent dir can’t be created, or when the copy fallback itself fails (source missing, destination not writable, disk full).