mirror of
https://github.com/YGGverse/btracker.git
synced 2026-03-31 17:15:31 +00:00
rename files buffer
This commit is contained in:
parent
5975552105
commit
4f6af5f03b
1 changed files with 5 additions and 5 deletions
|
|
@ -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 b = Vec::with_capacity(self.default_capacity);
|
let mut f = Vec::with_capacity(self.default_capacity);
|
||||||
for entry in fs::read_dir(&self.root)? {
|
for entry in fs::read_dir(&self.root)? {
|
||||||
let e = entry?;
|
let e = entry?;
|
||||||
let p = e.path();
|
let p = e.path();
|
||||||
|
|
@ -131,7 +131,7 @@ impl Public {
|
||||||
}) {
|
}) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
b.push(File {
|
f.push(File {
|
||||||
path: e.path(),
|
path: e.path(),
|
||||||
modified: e.metadata()?.modified()?,
|
modified: e.metadata()?.modified()?,
|
||||||
})
|
})
|
||||||
|
|
@ -139,11 +139,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 => b.sort_by(|a, b| a.modified.cmp(&b.modified)),
|
Order::Asc => f.sort_by(|a, b| a.modified.cmp(&b.modified)),
|
||||||
Order::Desc => b.sort_by(|a, b| b.modified.cmp(&a.modified)),
|
Order::Desc => f.sort_by(|a, b| b.modified.cmp(&a.modified)),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(b)
|
Ok(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue