summaryrefslogtreecommitdiffstats
path: root/src/io
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2019-06-05 16:41:26 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2019-06-05 16:41:31 -0400
commit89dadc7c604cb8367b90c4cc0f097d2fabc93ac6 (patch)
tree72725729821171385d36cc60579366a3b2e91c01 /src/io
parent530973aea3fa46c469541bc291513a75e3aacd3e (diff)
get_selected_paths now returns just a vec rather an option
- fix not being able to select the current entry
Diffstat (limited to 'src/io')
-rw-r--r--src/io/dirlist.rs9
-rw-r--r--src/io/metadata.rs1
2 files changed, 7 insertions, 3 deletions
diff --git a/src/io/dirlist.rs b/src/io/dirlist.rs
index f7a57a4..1b8d203 100644
--- a/src/io/dirlist.rs
+++ b/src/io/dirlist.rs
@@ -85,12 +85,15 @@ impl JoshutoDirList {
self.contents.iter().filter(|entry| entry.is_selected())
}
- pub fn get_selected_paths(&self) -> Option<Vec<&path::PathBuf>> {
+ pub fn get_selected_paths(&self) -> Vec<&path::PathBuf> {
let vec: Vec<&path::PathBuf> = self.selected_entries().map(|e| e.file_path()).collect();
if vec.is_empty() {
- Some(vec![self.get_curr_ref()?.file_path()])
+ match self.get_curr_ref() {
+ Some(s) => vec![s.file_path()],
+ _ => vec![],
+ }
} else {
- Some(vec)
+ vec
}
}
diff --git a/src/io/metadata.rs b/src/io/metadata.rs
index 341e8f2..fb85a6e 100644
--- a/src/io/metadata.rs
+++ b/src/io/metadata.rs
@@ -23,6 +23,7 @@ impl JoshutoMetadata {
let modified = metadata.modified()?;
let permissions = metadata.permissions();
let file_type = metadata.file_type();
+
#[cfg(unix)]
let uid = metadata.uid();
#[cfg(unix)]