Compare commits

...

2 Commits

Author SHA1 Message Date
Smit Barmase
1938ebbe5e print 2025-05-08 04:10:00 +05:30
Smit Barmase
7174410bf2 attempt to fix windows atomic write 2025-05-08 03:44:38 +05:30

View File

@@ -511,7 +511,23 @@ impl Fs for RealFs {
}
async fn open_handle(&self, path: &Path) -> Result<Arc<dyn FileHandle>> {
Ok(Arc::new(std::fs::File::open(path)?))
#[cfg(target_os = "windows")]
{
use std::os::windows::fs::OpenOptionsExt;
use windows::Win32::Storage::FileSystem::{
FILE_SHARE_DELETE, FILE_SHARE_READ, FILE_SHARE_WRITE,
};
let file = std::fs::OpenOptions::new()
.read(true)
.share_mode(FILE_SHARE_READ.0 | FILE_SHARE_WRITE.0 | FILE_SHARE_DELETE.0)
.open(path)?;
println!("opening with new permissions");
Ok(Arc::new(file))
}
#[cfg(not(target_os = "windows"))]
{
Ok(Arc::new(std::fs::File::open(path)?))
}
}
async fn load(&self, path: &Path) -> Result<String> {