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