]> git.bitcoin.ninja Git - rust-lightning/commitdiff
fixups
authorValentine Wallace <vwallace@protonmail.com>
Wed, 17 Feb 2021 03:14:16 +0000 (22:14 -0500)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 17 Feb 2021 03:38:17 +0000 (22:38 -0500)
lightning-persister/src/util.rs

index ac923d6857670e3b4b8559e357733d80b6d56d26..9e27c17cc7f3a377f536f0ea628970e5e83b8ce3 100644 (file)
@@ -93,18 +93,22 @@ 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);
+               let src = PathBuf::from(tmp_filename.clone());
+               let dst = PathBuf::from(filename_with_path.clone());
                // 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
                // )});
-               let backup_filepath = format!("{}.backup", filename_with_path.clone());
-               call!(unsafe {winapi::um::winbase::ReplaceFileW(
+               let backup_filepath = PathBuf::from(format!("{}.backup", filename_with_path.clone()));
+               // call!(unsafe {winapi::um::winbase::ReplaceFileW(
+               //      path_to_windows_str(src).as_ptr(), path_to_windows_str(dst).as_ptr(), path_to_windows_str(backup_filepath).as_ptr(),
+               //      winapi::um::winbase::MOVEFILE_WRITE_THROUGH | winapi::um::winbase::MOVEFILE_REPLACE_EXISTING, std::ptr::null_mut() as *mut winapi::ctypes::c_void, std::ptr::null_mut() as *mut winapi::ctypes::c_void
+               // )});
+               unsafe {winapi::um::winbase::ReplaceFileW(
                        path_to_windows_str(src).as_ptr(), path_to_windows_str(dst).as_ptr(), path_to_windows_str(backup_filepath).as_ptr(),
-                       winapi::um::winbase::MOVEFILE_WRITE_THROUGH | winapi::um::winbase::MOVEFILE_REPLACE_EXISTING, std::ptr::null, std::ptr::null
-               )});
+                       winapi::um::winbase::MOVEFILE_WRITE_THROUGH | winapi::um::winbase::MOVEFILE_REPLACE_EXISTING, std::ptr::null_mut() as *mut winapi::ctypes::c_void, std::ptr::null_mut() as *mut winapi::ctypes::c_void
+               )};
                println!("VMW: renamed");
        }
        Ok(())