use long name for files buffer

This commit is contained in:
yggverse 2025-08-11 18:27:42 +03:00
parent 3fab9b40bf
commit 5c0dd2a84f

View file

@ -103,7 +103,7 @@ impl Public {
keyword: Option<&str>, keyword: Option<&str>,
sort_order: Option<(Sort, Order)>, sort_order: Option<(Sort, Order)>,
) -> Result<Vec<File>, Error> { ) -> Result<Vec<File>, Error> {
let mut f = Vec::with_capacity(self.default_capacity); let mut files = Vec::with_capacity(self.default_capacity);
for dir_entry in fs::read_dir(&self.root)? { for dir_entry in fs::read_dir(&self.root)? {
let entry = dir_entry?; let entry = dir_entry?;
let path = entry.path(); let path = entry.path();
@ -127,7 +127,7 @@ impl Public {
{ {
continue; continue;
} }
f.push(File { files.push(File {
modified: entry.metadata()?.modified()?, modified: entry.metadata()?.modified()?,
path, path,
}) })
@ -135,11 +135,11 @@ impl Public {
if let Some((sort, order)) = sort_order { if let Some((sort, order)) = sort_order {
match sort { match sort {
Sort::Modified => match order { Sort::Modified => match order {
Order::Asc => f.sort_by(|a, b| a.modified.cmp(&b.modified)), Order::Asc => files.sort_by(|a, b| a.modified.cmp(&b.modified)),
Order::Desc => f.sort_by(|a, b| b.modified.cmp(&a.modified)), Order::Desc => files.sort_by(|a, b| b.modified.cmp(&a.modified)),
}, },
} }
} }
Ok(f) Ok(files)
} }
} }