mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-30 20:09:50 +03:00
Merge pull request #2098 from gitbutlerapp/add-windows-metadata-shim
Add windows metadata shim
This commit is contained in:
commit
807aa56e82
@ -5,6 +5,8 @@ use std::{
|
||||
path, time,
|
||||
};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use crate::windows::*;
|
||||
#[cfg(target_family = "unix")]
|
||||
use std::os::unix::prelude::*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![feature(error_generic_member_access)]
|
||||
#![cfg_attr(target_os = "windows", feature(windows_by_handle))]
|
||||
|
||||
pub mod analytics;
|
||||
pub mod app;
|
||||
@ -29,6 +30,8 @@ pub mod types;
|
||||
pub mod users;
|
||||
pub mod virtual_branches;
|
||||
pub mod watcher;
|
||||
#[cfg(target_os = "windows")]
|
||||
pub(crate) mod windows;
|
||||
pub mod writer;
|
||||
pub mod zip;
|
||||
|
||||
|
23
packages/tauri/src/windows.rs
Normal file
23
packages/tauri/src/windows.rs
Normal file
@ -0,0 +1,23 @@
|
||||
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)")
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user