|
|
@@ -1,11 +1,14 @@
|
|
|
use std::cmp::max;
|
|
|
+#[cfg(unix)]
|
|
|
use std::env;
|
|
|
use std::ops::Deref;
|
|
|
#[cfg(unix)]
|
|
|
use std::sync::{Mutex, MutexGuard};
|
|
|
|
|
|
use datetime::TimeZone;
|
|
|
-use zoneinfo_compiled::{CompiledData, Result as TZResult};
|
|
|
+#[cfg(unix)]
|
|
|
+use zoneinfo_compiled::CompiledData;
|
|
|
+use zoneinfo_compiled::Result as TZResult;
|
|
|
|
|
|
use lazy_static::lazy_static;
|
|
|
use log::*;
|
|
|
@@ -15,11 +18,11 @@ use uzers::UsersCache;
|
|
|
use crate::fs::{File, fields as f};
|
|
|
use crate::fs::feature::git::GitCache;
|
|
|
use crate::output::cell::TextCell;
|
|
|
+use crate::output::render::{PermissionsPlusRender, TimeRender};
|
|
|
+#[cfg(unix)]
|
|
|
use crate::output::render::{
|
|
|
GroupRender,
|
|
|
OctalPermissionsRender,
|
|
|
- PermissionsPlusRender,
|
|
|
- TimeRender,
|
|
|
UserRender
|
|
|
};
|
|
|
use crate::output::time::TimeFormat;
|
|
|
@@ -104,6 +107,7 @@ impl Columns {
|
|
|
columns.push(Column::Group);
|
|
|
}
|
|
|
|
|
|
+ #[cfg(target_os = "linux")]
|
|
|
if self.security_context {
|
|
|
columns.push(Column::SecurityContext);
|
|
|
}
|
|
|
@@ -192,7 +196,7 @@ impl Column {
|
|
|
}
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
- pub fn alignment(&self) -> Alignment {
|
|
|
+ pub fn alignment(self) -> Alignment {
|
|
|
match self {
|
|
|
Self::FileSize |
|
|
|
Self::GitStatus => Alignment::Right,
|
|
|
@@ -392,6 +396,7 @@ fn determine_time_zone() -> TZResult<TimeZone> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#[allow(clippy::unnecessary_wraps)] // Needs to match Unix function
|
|
|
#[cfg(windows)]
|
|
|
fn determine_time_zone() -> TZResult<TimeZone> {
|
|
|
use datetime::zone::{FixedTimespan, FixedTimespanSet, StaticTimeZone, TimeZoneSource};
|
|
|
@@ -406,7 +411,7 @@ fn determine_time_zone() -> TZResult<TimeZone> {
|
|
|
name: Cow::Borrowed("ZONE_A"),
|
|
|
},
|
|
|
rest: &[(
|
|
|
- 1206838800,
|
|
|
+ 1_206_838_800, // Sun Mar 30 2008 01:00:00 GMT+0000
|
|
|
FixedTimespan {
|
|
|
offset: 3600,
|
|
|
is_dst: false,
|
|
|
@@ -429,6 +434,7 @@ pub struct Table<'a> {
|
|
|
widths: TableWidths,
|
|
|
time_format: TimeFormat,
|
|
|
size_format: SizeFormat,
|
|
|
+ #[cfg(unix)]
|
|
|
user_format: UserFormat,
|
|
|
git: Option<&'a GitCache>,
|
|
|
}
|
|
|
@@ -452,6 +458,7 @@ impl<'a> Table<'a> {
|
|
|
env,
|
|
|
time_format: options.time_format,
|
|
|
size_format: options.size_format,
|
|
|
+ #[cfg(unix)]
|
|
|
user_format: options.user_format,
|
|
|
}
|
|
|
}
|
|
|
@@ -480,14 +487,23 @@ impl<'a> Table<'a> {
|
|
|
self.widths.add_widths(row);
|
|
|
}
|
|
|
|
|
|
+ #[cfg(unix)]
|
|
|
fn permissions_plus(&self, file: &File<'_>, xattrs: bool) -> Option<f::PermissionsPlus> {
|
|
|
file.permissions().map(|p| f::PermissionsPlus {
|
|
|
file_type: file.type_char(),
|
|
|
- #[cfg(unix)]
|
|
|
permissions: p,
|
|
|
+ xattrs
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ #[allow(clippy::unnecessary_wraps)] // Needs to match Unix function
|
|
|
+ #[cfg(windows)]
|
|
|
+ fn permissions_plus(&self, file: &File<'_>, xattrs: bool) -> Option<f::PermissionsPlus> {
|
|
|
+ Some(f::PermissionsPlus {
|
|
|
+ file_type: file.type_char(),
|
|
|
#[cfg(windows)]
|
|
|
attributes: file.attributes(),
|
|
|
- xattrs
|
|
|
+ xattrs,
|
|
|
})
|
|
|
}
|
|
|
|