From: Valentine Wallace Date: Wed, 17 Feb 2021 01:51:09 +0000 (-0500) Subject: make writeable X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=1acd1236863a0d173bd051d0140af46c68147b2f;p=rust-lightning make writeable --- 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);