From 603f971d3a830d53d55d321f079cd1886b322fec Mon Sep 17 00:00:00 2001 From: JC Date: Sun, 22 Feb 2026 16:07:32 -0700 Subject: [PATCH] fix: in windows no need to sync the folder when saving --- zingolib/src/lightclient/save.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zingolib/src/lightclient/save.rs b/zingolib/src/lightclient/save.rs index 302e3414b..6a0288fdc 100644 --- a/zingolib/src/lightclient/save.rs +++ b/zingolib/src/lightclient/save.rs @@ -27,9 +27,14 @@ fn write_to_path(wallet_path: &std::path::Path, bytes: &[u8]) -> std::io::Result let file = writer.into_inner().map_err(|e| e.into_error())?; file.sync_all()?; std::fs::rename(&temp_wallet_path, wallet_path)?; - if let Some(parent) = wallet_path.parent() { - let wallet_dir = std::fs::File::open(parent)?; - let _ignore_error = wallet_dir.sync_all(); // NOTE: error is ignored as syncing dirs on windows OS may return an error + + // NOTE: in windows no need to sync the folder, only for linux & macOS. + #[cfg(unix)] + { + if let Some(parent) = wallet_path.parent() { + let wallet_dir = std::fs::File::open(parent)?; + let _ignore_error = wallet_dir.sync_all(); // NOTE: error is ignored as syncing dirs on windows OS may return an error + } } Ok(())