mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Gid, uid to u32
This commit is contained in:
@@ -49,8 +49,8 @@ pub struct FsDirectory {
|
||||
pub creation_time: SystemTime,
|
||||
pub readonly: bool,
|
||||
pub symlink: Option<PathBuf>, // UNIX only
|
||||
pub user: Option<String>, // UNIX only
|
||||
pub group: Option<String>, // UNIX only
|
||||
pub user: Option<u32>, // UNIX only
|
||||
pub group: Option<u32>, // UNIX only
|
||||
pub unix_pex: Option<(u8, u8, u8)>, // UNIX only
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ pub struct FsFile {
|
||||
pub ftype: Option<String>, // File type
|
||||
pub readonly: bool,
|
||||
pub symlink: Option<PathBuf>, // UNIX only
|
||||
pub user: Option<String>, // UNIX only
|
||||
pub group: Option<String>, // UNIX only
|
||||
pub user: Option<u32>, // UNIX only
|
||||
pub group: Option<u32>, // UNIX only
|
||||
pub unix_pex: Option<(u8, u8, u8)>, // UNIX only
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ extern crate users;
|
||||
#[cfg(any(unix, macos, linux))]
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
#[cfg(any(unix, macos, linux))]
|
||||
use users::{get_group_by_gid, get_user_by_uid};
|
||||
// use users::{get_group_by_gid, get_user_by_uid};
|
||||
|
||||
// Locals
|
||||
use crate::fs::{FsDirectory, FsEntry, FsFile};
|
||||
@@ -259,6 +259,7 @@ impl Localhost {
|
||||
let path: PathBuf = entry.path();
|
||||
let attr: Metadata = fs::metadata(path.clone()).unwrap();
|
||||
// Get user stuff
|
||||
/*
|
||||
let user: Option<String> = match get_user_by_uid(attr.uid()) {
|
||||
Some(user) => Some(String::from(user.name().to_str().unwrap_or(""))),
|
||||
None => None,
|
||||
@@ -267,6 +268,7 @@ impl Localhost {
|
||||
Some(group) => Some(String::from(group.name().to_str().unwrap_or(""))),
|
||||
None => None,
|
||||
};
|
||||
*/
|
||||
let file_name: String =
|
||||
String::from(path.file_name().unwrap().to_str().unwrap_or(""));
|
||||
// Match dir / file
|
||||
@@ -284,8 +286,8 @@ impl Localhost {
|
||||
Ok(p) => Some(p),
|
||||
Err(_) => None,
|
||||
},
|
||||
user: user,
|
||||
group: group,
|
||||
user: Some(attr.uid()),
|
||||
group: Some(attr.gid()),
|
||||
unix_pex: Some(self.u32_to_mode(attr.mode())),
|
||||
})
|
||||
}
|
||||
@@ -308,8 +310,8 @@ impl Localhost {
|
||||
Ok(p) => Some(p),
|
||||
Err(_) => None,
|
||||
},
|
||||
user: user,
|
||||
group: group,
|
||||
user: Some(attr.uid()),
|
||||
group: Some(attr.gid()),
|
||||
unix_pex: Some(self.u32_to_mode(attr.mode())),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user