]> git.bitcoin.ninja Git - rust-lightning/commitdiff
make writeable
authorValentine Wallace <vwallace@protonmail.com>
Wed, 17 Feb 2021 01:51:09 +0000 (20:51 -0500)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 17 Feb 2021 01:51:09 +0000 (20:51 -0500)
lightning-persister/src/util.rs

index 7d63a41565bac14edca10707f62499544caef96e..79b11bb67782b8077c1374a4fb8f634e58528e5b 100644 (file)
@@ -78,6 +78,13 @@ pub(crate) fn write_to_file<D: DiskWriteable>(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);