gitbutler/gitbutler-app/src/windows.rs

25 lines
831 B
Rust
Raw Normal View History

2023-12-19 12:43:26 +03:00
use std::os::windows::fs::MetadataExt;
pub trait MetadataShim {
fn ino(&self) -> u64;
fn dev(&self) -> u64;
fn uid(&self) -> u32;
fn gid(&self) -> u32;
}
impl MetadataShim for std::fs::Metadata {
fn ino(&self) -> u64 {
self.file_index().expect("file metadata constructed based on directory listing instead of a file (see https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.file_index)")
}
2023-12-19 13:11:23 +03:00
#[allow(clippy::cast_lossless)]
2023-12-19 12:43:26 +03:00
fn dev(&self) -> u64 {
self.volume_serial_number().expect("file metadata constructed based on directory listing instead of a file (see https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.volume_serial_number)") as u64
}
fn uid(&self) -> u32 {
0
}
fn gid(&self) -> u32 {
0
}
}