mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-01 04:14:45 +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,
|
path, time,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
use crate::windows::*;
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
use std::os::unix::prelude::*;
|
use std::os::unix::prelude::*;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#![feature(error_generic_member_access)]
|
#![feature(error_generic_member_access)]
|
||||||
|
#![cfg_attr(target_os = "windows", feature(windows_by_handle))]
|
||||||
|
|
||||||
pub mod analytics;
|
pub mod analytics;
|
||||||
pub mod app;
|
pub mod app;
|
||||||
@ -29,6 +30,8 @@ pub mod types;
|
|||||||
pub mod users;
|
pub mod users;
|
||||||
pub mod virtual_branches;
|
pub mod virtual_branches;
|
||||||
pub mod watcher;
|
pub mod watcher;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
pub(crate) mod windows;
|
||||||
pub mod writer;
|
pub mod writer;
|
||||||
pub mod zip;
|
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