Try to fix CI

This commit is contained in:
Chester Liu 2021-03-28 09:31:03 +08:00
parent 33dd8fd2ca
commit e874584a55
3 changed files with 38 additions and 32 deletions

View File

@ -325,15 +325,8 @@ impl<'dir> File<'dir> {
///
/// Block and character devices return their device IDs, because they
/// usually just have a file size of zero.
#[cfg(unix)]
pub fn size(&self) -> f::Size {
#[cfg(windows)]
if self.is_directory() {
f::Size::None
}
else {
f::Size::Some(self.metadata.len())
}
#[cfg(unix)]
if self.is_directory() {
f::Size::None
}
@ -349,6 +342,16 @@ impl<'dir> File<'dir> {
}
}
#[cfg(windows)]
pub fn size(&self) -> f::Size {
if self.is_directory() {
f::Size::None
}
else {
f::Size::Some(self.metadata.len())
}
}
/// This files last modified timestamp, if available on this platform.
pub fn modified_time(&self) -> Option<SystemTime> {
self.metadata.modified().ok()
@ -394,18 +397,6 @@ impl<'dir> File<'dir> {
/// This is used a the leftmost character of the permissions column.
/// The file type can usually be guessed from the colour of the file, but
/// ls puts this character there.
#[cfg(windows)]
pub fn type_char(&self) -> f::Type {
if self.is_file() {
f::Type::File
}
else if self.is_directory() {
f::Type::Directory
}
else {
f::Type::Special
}
}
#[cfg(unix)]
pub fn type_char(&self) -> f::Type {
if self.is_file() {
@ -434,6 +425,19 @@ impl<'dir> File<'dir> {
}
}
#[cfg(windows)]
pub fn type_char(&self) -> f::Type {
if self.is_file() {
f::Type::File
}
else if self.is_directory() {
f::Type::Directory
}
else {
f::Type::Special
}
}
/// This files permissions, with flags for each bit.
#[cfg(unix)]
pub fn permissions(&self) -> f::Permissions {

View File

@ -78,6 +78,7 @@ impl SortField {
"age" | "old" | "oldest" => {
Self::ModifiedAge
}
"ch" | "changed" => {
Self::ChangedDate
}

View File

@ -235,18 +235,6 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
/// The character to be displayed after a file when classifying is on, if
/// the files type has one associated with it.
#[cfg(windows)]
fn classify_char(&self) -> Option<&'static str> {
if self.file.is_directory() {
Some("/")
}
else if self.file.is_link() {
Some("@")
}
else {
None
}
}
#[cfg(unix)]
fn classify_char(&self) -> Option<&'static str> {
if self.file.is_executable_file() {
@ -269,6 +257,19 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
}
}
#[cfg(windows)]
fn classify_char(&self) -> Option<&'static str> {
if self.file.is_directory() {
Some("/")
}
else if self.file.is_link() {
Some("@")
}
else {
None
}
}
/// Returns at least one ANSI-highlighted string representing this files
/// name using the given set of colours.
///