From 6155252ac8d6fb4020ee2acc48ecec3934dc965a Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Wed, 17 Jun 2015 01:49:29 +0200 Subject: [PATCH 1/3] metadata.as_raw() is gone in nightly --- src/file.rs | 16 ++++++++-------- src/options.rs | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/file.rs b/src/file.rs index 3d432cb..a8cc06d 100644 --- a/src/file.rs +++ b/src/file.rs @@ -223,7 +223,7 @@ impl<'dir> File<'dir> { /// with multiple links much more often. Thus, it should get highlighted /// more attentively. pub fn links(&self) -> f::Links { - let count = self.metadata.as_raw().nlink(); + let count = self.metadata.nlink(); f::Links { count: count, @@ -233,7 +233,7 @@ impl<'dir> File<'dir> { /// This file's inode. pub fn inode(&self) -> f::Inode { - f::Inode(self.metadata.as_raw().ino()) + f::Inode(self.metadata.ino()) } /// This file's number of filesystem blocks. @@ -241,7 +241,7 @@ impl<'dir> File<'dir> { /// (Not the size of each block, which we don't actually report on) pub fn blocks(&self) -> f::Blocks { if self.is_file() || self.is_link() { - f::Blocks::Some(self.metadata.as_raw().blocks()) + f::Blocks::Some(self.metadata.blocks()) } else { f::Blocks::None @@ -250,12 +250,12 @@ impl<'dir> File<'dir> { /// The ID of the user that own this file. pub fn user(&self) -> f::User { - f::User(self.metadata.as_raw().uid()) + f::User(self.metadata.uid()) } /// The ID of the group that owns this file. pub fn group(&self) -> f::Group { - f::Group(self.metadata.as_raw().gid()) + f::Group(self.metadata.gid()) } /// This file's size, if it's a regular file. @@ -275,9 +275,9 @@ impl<'dir> File<'dir> { /// One of this file's timestamps, as a number in seconds. pub fn timestamp(&self, time_type: TimeType) -> f::Time { let time_in_seconds = match time_type { - TimeType::FileAccessed => self.metadata.as_raw().atime(), - TimeType::FileModified => self.metadata.as_raw().mtime(), - TimeType::FileCreated => self.metadata.as_raw().ctime(), + TimeType::FileAccessed => self.metadata.atime(), + TimeType::FileModified => self.metadata.mtime(), + TimeType::FileCreated => self.metadata.ctime(), }; f::Time(time_in_seconds) diff --git a/src/options.rs b/src/options.rs index 2fbaa7e..f0a49e2 100644 --- a/src/options.rs +++ b/src/options.rs @@ -132,10 +132,10 @@ impl FileFilter { SortField::Unsorted => {}, SortField::Name => files.sort_by(|a, b| natord::compare(&*a.name, &*b.name)), SortField::Size => files.sort_by(|a, b| a.metadata.len().cmp(&b.metadata.len())), - SortField::FileInode => files.sort_by(|a, b| a.metadata.as_raw().ino().cmp(&b.metadata.as_raw().ino())), - SortField::ModifiedDate => files.sort_by(|a, b| a.metadata.as_raw().mtime().cmp(&b.metadata.as_raw().mtime())), - SortField::AccessedDate => files.sort_by(|a, b| a.metadata.as_raw().atime().cmp(&b.metadata.as_raw().atime())), - SortField::CreatedDate => files.sort_by(|a, b| a.metadata.as_raw().ctime().cmp(&b.metadata.as_raw().ctime())), + SortField::FileInode => files.sort_by(|a, b| a.metadata.ino().cmp(&b.metadata.ino())), + SortField::ModifiedDate => files.sort_by(|a, b| a.metadata.mtime().cmp(&b.metadata.mtime())), + SortField::AccessedDate => files.sort_by(|a, b| a.metadata.atime().cmp(&b.metadata.atime())), + SortField::CreatedDate => files.sort_by(|a, b| a.metadata.ctime().cmp(&b.metadata.ctime())), SortField::Extension => files.sort_by(|a, b| match a.ext.cmp(&b.ext) { cmp::Ordering::Equal => natord::compare(&*a.name, &*b.name), order => order, From a0105b951dca33abfb4f16dfd144785e3e458e3a Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Wed, 17 Jun 2015 01:52:06 +0200 Subject: [PATCH 2/3] Move dummy xattr Attribute implementation into its own module. --- src/feature/mod.rs | 35 ++--------------------------------- src/feature/xattr_dummy.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 33 deletions(-) create mode 100644 src/feature/xattr_dummy.rs diff --git a/src/feature/mod.rs b/src/feature/mod.rs index 24ebbe9..7985af5 100644 --- a/src/feature/mod.rs +++ b/src/feature/mod.rs @@ -6,39 +6,8 @@ #[cfg(target_os = "linux")] mod xattr_linux; #[cfg(target_os = "linux")] pub use self::xattr_linux::Attribute; -#[cfg(not(any(target_os = "macos", target_os = "linux")))] use std::old_io as io; -#[cfg(not(any(target_os = "macos", target_os = "linux")))] - - -#[derive(Clone)] -pub struct Attribute; - -#[cfg(not(any(target_os = "macos", target_os = "linux")))] -impl Attribute { - - /// Getter for name - pub fn name(&self) -> &str { - unimplemented!() - } - - /// Getter for size - pub fn size(&self) -> usize { - unimplemented!() - } - - /// Lists the extended attributes. Follows symlinks like `metadata` - pub fn list(_: &Path) -> io::IoResult> { - Ok(Vec::new()) - } - - /// Lists the extended attributes. Does not follow symlinks like `symlink_metadata` - pub fn llist(_: &Path) -> io::IoResult> { - Ok(Vec::new()) - } - - pub fn feature_implemented() -> bool { false } -} - +#[cfg(not(any(target_os = "macos", target_os = "linux")))] mod xattr_dummy; +#[cfg(not(any(target_os = "macos", target_os = "linux")))] pub use self::xattr_dummy::Attribute; // Git support diff --git a/src/feature/xattr_dummy.rs b/src/feature/xattr_dummy.rs new file mode 100644 index 0000000..04686d4 --- /dev/null +++ b/src/feature/xattr_dummy.rs @@ -0,0 +1,32 @@ +use std::io; +use std::path::Path; + +#[derive(Clone)] +pub struct Attribute; + +impl Attribute { + + /// Getter for name + pub fn name(&self) -> &str { + unimplemented!() + } + + /// Getter for size + pub fn size(&self) -> usize { + unimplemented!() + } + + /// Lists the extended attributes. Follows symlinks like `metadata` + pub fn list(_: &Path) -> io::Result> { + Ok(Vec::new()) + } + + /// Lists the extended attributes. Does not follow symlinks like `symlink_metadata` + pub fn llist(_: &Path) -> io::Result> { + Ok(Vec::new()) + } + + pub fn feature_implemented() -> bool { false } +} + + From 96018841f64dd0a7d0da72e7d80a69192c76864f Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Wed, 17 Jun 2015 02:13:53 +0200 Subject: [PATCH 3/3] Fix terminal window size for DragonFly --- src/term.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/term.rs b/src/term.rs index 7f69b54..15b9b0d 100644 --- a/src/term.rs +++ b/src/term.rs @@ -16,7 +16,7 @@ mod c { #[cfg(any(target_os = "linux", target_os = "android"))] static TIOCGWINSZ: c_ulong = 0x5413; - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "dragonfly"))] static TIOCGWINSZ: c_ulong = 0x40087468; extern {