]> git.bitcoin.ninja Git - rust-lightning/commitdiff
switch back to fs::rename
authorValentine Wallace <vwallace@protonmail.com>
Wed, 17 Feb 2021 02:31:06 +0000 (21:31 -0500)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 17 Feb 2021 02:33:12 +0000 (21:33 -0500)
lightning-persister/src/util.rs

index a94c7d001f56e4544d9da7e6c829e563d779c7f6..8b24611e591f12166586069f25f38d8ee9e658e3 100644 (file)
@@ -92,12 +92,13 @@ pub(crate) fn write_to_file<D: DiskWriteable>(path: String, filename: String, da
     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);
-               call!(unsafe {winapi::um::winbase::MoveFileExW(
-                       path_to_windows_str(src).as_ptr(), path_to_windows_str(dst).as_ptr(),
-                       winapi::um::winbase::MOVEFILE_WRITE_THROUGH | winapi::um::winbase::MOVEFILE_REPLACE_EXISTING
-               )});
+               // let src = PathBuf::from(tmp_filename);
+               // let dst = PathBuf::from(filename_with_path);
+               fs::rename(&tmp_filename.clone(), &filename_with_path.clone())?;
+               // call!(unsafe {winapi::um::winbase::MoveFileExW(
+               //      path_to_windows_str(src).as_ptr(), path_to_windows_str(dst).as_ptr(),
+               //      winapi::um::winbase::MOVEFILE_WRITE_THROUGH | winapi::um::winbase::MOVEFILE_REPLACE_EXISTING
+               // )});
                println!("VMW: renamed");
        }
        Ok(())