fix: copy file if necessary

This commit is contained in:
Anna 2018-08-13 19:48:16 -04:00
parent d895c98d42
commit c7f94a6e22
1 changed files with 6 additions and 1 deletions

View File

@ -83,7 +83,12 @@ impl Job {
if let Some(p) = file_path.parent() {
std::fs::create_dir_all(p)?;
}
std::fs::rename(&f, &file_path)?;
match std::fs::rename(&f, &file_path) {
Err(ref e) if cfg!(windows) && e.raw_os_error() == Some(17) => {
std::fs::copy(&f, &file_path)?;
},
_ => {},
}
*f = file_path;
}