summaryrefslogtreecommitdiffstats
path: root/src/fscache.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/fscache.rs')
-rw-r--r--src/fscache.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/fscache.rs b/src/fscache.rs
index e5b1340..1c5ab17 100644
--- a/src/fscache.rs
+++ b/src/fscache.rs
@@ -130,6 +130,7 @@ impl FsCache {
let files = self.get_files(&dir, Stale::new())?.1;
let mut files = files.wait()?;
FsCache::apply_settingss(&self, &mut files).ok();
+ let files = FsCache::ensure_not_empty(files)?;
Ok(files)
}
@@ -230,6 +231,7 @@ impl FsCache {
}
files.sort();
+ let files = FsCache::ensure_not_empty(files)?;
Ok(files)
}));
@@ -265,6 +267,15 @@ impl FsCache {
Ok(())
}
+ pub fn ensure_not_empty(mut files: Files) -> HResult<Files> {
+ if files.len() == 0 {
+ let path = &files.directory.path;
+ let placeholder = File::new_placeholder(&path)?;
+ files.files.push(placeholder);
+ }
+ Ok(files)
+ }
+
fn extract_tab_settings(files: &Files, selection: Option<File>) -> TabSettings {
TabSettings {