From 1acd1236863a0d173bd051d0140af46c68147b2f Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Tue, 16 Feb 2021 20:51:09 -0500 Subject: [PATCH] make writeable --- lightning-persister/src/util.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lightning-persister/src/util.rs b/lightning-persister/src/util.rs index 7d63a4156..79b11bb67 100644 --- a/lightning-persister/src/util.rs +++ b/lightning-persister/src/util.rs @@ -78,6 +78,13 @@ pub(crate) fn write_to_file(path: String, filename: String, da } #[cfg(target_os = "windows")] { + if let Ok(metadata) = fs::metadata(filename_with_path.clone()) { + let mut perms = metadata.permissions(); + perms.set_readonly(false); + } + // let mut perms = fs::metadata(filename_with_path.clone())?.permissions(); + let mut tmp_perms = fs::metadata(tmp_filename.clone())?.permissions(); + tmp_perms.set_readonly(false); println!("VMW: about to rename"); let src = PathBuf::from(tmp_filename); let dst = PathBuf::from(filename_with_path); -- 2.39.5