This commit is contained in:
sxyazi 2023-11-07 09:16:03 +08:00
parent cebb1c1312
commit c6b39e2e9f
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -26,7 +26,7 @@ pub struct Cha {
pub created: Option<SystemTime>,
pub modified: Option<SystemTime>,
#[cfg(unix)]
pub permissions: u16,
pub permissions: u32,
}
impl From<Metadata> for Cha {
@ -63,7 +63,7 @@ impl From<Metadata> for Cha {
#[cfg(unix)]
permissions: {
use std::os::unix::prelude::PermissionsExt;
m.permissions().mode() as u16
m.permissions().mode()
},
}
}

View file

@ -94,12 +94,12 @@ pub fn copy_with_progress(from: &Path, to: &Path) -> mpsc::Receiver<Result<u64,
// Convert a file mode to a string representation
#[cfg(windows)]
#[allow(clippy::collapsible_else_if)]
pub fn permissions(_: Permissions) -> Option<String> { None }
pub fn permissions(_: u32) -> Option<String> { None }
// Convert a file mode to a string representation
#[cfg(unix)]
#[allow(clippy::collapsible_else_if)]
pub fn permissions(mode: u16) -> Option<String> {
pub fn permissions(mode: u32) -> Option<String> {
use libc::{mode_t, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFSOCK, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR};
let mut s = String::with_capacity(10);