Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Windows: flush copied library files through a writable handle

Yashwanth Kamireddi9f5b0647394b
diff --git a/src-tauri/src/migrate.rs b/src-tauri/src/migrate.rs
index 7b6b8f2..3d0f4ca 100644
--- a/src-tauri/src/migrate.rs
+++ b/src-tauri/src/migrate.rs
@@ -699,7 +699,8 @@ fn copy_tree(from: &Path, to: &Path, mover: &Mover) -> io::Result<()> {
copy_tree(&src, &dst, mover)?;
} else {
fs::copy(&src, &dst)?;
- fs::File::open(&dst)?.sync_all()?;
+ // Opened for writing: Windows refuses to flush a read-only handle (Access denied).
+ fs::OpenOptions::new().write(true).open(&dst)?.sync_all()?;
(mover.checkpoint)(Step::CopiedOne)?;
}
}