flush+sync the version file just in case

This commit is contained in:
Tamo 2025-02-06 18:04:43 +01:00
parent ae1d7f4d9b
commit 8c5856007c
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -1,5 +1,5 @@
use std::fs;
use std::io::{self, ErrorKind};
use std::fs::{self, File};
use std::io::{self, ErrorKind, Write};
use std::path::Path;
use milli::heed;
@ -23,7 +23,10 @@ pub fn create_version_file(
patch: &str,
) -> io::Result<()> {
let version_path = db_path.join(VERSION_FILE_NAME);
fs::write(version_path, format!("{}.{}.{}", major, minor, patch))
let mut file = File::create(&version_path)?;
file.write_all(format!("{}.{}.{}", major, minor, patch).as_bytes())?;
file.flush()?;
file.sync_all()
}
pub fn get_version(db_path: &Path) -> Result<(u32, u32, u32), VersionFileError> {