diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-05-01 18:25:57 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-05-01 18:25:57 -0400 |
commit | 08b6345e4e03dbd30f7eef2c0eba18b3bf9981a7 (patch) | |
tree | 0e81e89ad4485e906b61503e2d38f692dfe2e7a8 /src/fs | |
parent | 4cdb291fc36ae71cd9514d5e030f60ff5712eda3 (diff) |
make index public attribute
- remove unused code and add #[allow(dead_code)]
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/metadata.rs | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/src/fs/metadata.rs b/src/fs/metadata.rs index aa6dcad..ef7e1c9 100644 --- a/src/fs/metadata.rs +++ b/src/fs/metadata.rs @@ -1,4 +1,4 @@ -use std::{fs, io, path, process, time}; +use std::{fs, io, path, time}; #[derive(Clone, Debug)] pub enum FileType { @@ -13,7 +13,6 @@ pub struct JoshutoMetadata { _modified: time::SystemTime, _permissions: fs::Permissions, _file_type: FileType, - pub mimetype: Option<String>, #[cfg(unix)] pub uid: u32, #[cfg(unix)] @@ -49,14 +48,6 @@ impl JoshutoMetadata { FileType::File }; - let mut mimetype = None; - if let FileType::File = file_type { - #[cfg(feature = "file_mimetype")] - { - mimetype = file_mimetype(path) - } - } - #[cfg(unix)] let uid = metadata.uid(); #[cfg(unix)] @@ -69,7 +60,6 @@ impl JoshutoMetadata { _modified, _permissions, _file_type: file_type, - mimetype, #[cfg(unix)] uid, #[cfg(unix)] @@ -99,24 +89,3 @@ impl JoshutoMetadata { &self._file_type } } - -fn file_mimetype(path: &path::Path) -> Option<String> { - let output = process::Command::new("file") - .args(&["-Lb", "--mime-type"]) - .arg(path) - .output(); - - match output { - Ok(s) => { - if s.status.success() { - match String::from_utf8(s.stdout) { - Ok(s) => Some(s), - Err(_) => None, - } - } else { - None - } - } - Err(_) => None, - } -} |