From c7f94a6e220253cd9c3b61e552336e0d87e7d0e1 Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 13 Aug 2018 19:48:16 -0400 Subject: [PATCH] fix: copy file if necessary --- src/config/job.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config/job.rs b/src/config/job.rs index 59c1d52..6dcb505 100644 --- a/src/config/job.rs +++ b/src/config/job.rs @@ -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; }