Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(app): open the settings backup writable so Windows can sync it

thinhlpg9dd650c17afa
diff --git a/src-tauri/src/core/app/settings_store.rs b/src-tauri/src/core/app/settings_store.rs
index 019ff3026..f39cac245 100644
--- a/src-tauri/src/core/app/settings_store.rs
+++ b/src-tauri/src/core/app/settings_store.rs
@@ -309,8 +309,11 @@ fn backup_once_to(store: &Store, path: &PathBuf) -> Result<bool, String> {
}
write_map_atomic(path, &snapshot)?;
// This file is the only copy of what the change replaces: make it durable
- // before the caller goes ahead.
- fs::File::open(path)
+ // before the caller goes ahead. Opened writable: Windows refuses to flush
+ // a read-only handle (FlushFileBuffers needs write access).
+ fs::OpenOptions::new()
+ .write(true)
+ .open(path)
.and_then(|f| f.sync_all())
.map_err(|e| e.to_string())?;
Ok(true)