fix: Panic on long numerical file names

Closes: #258

[lexical_sort](https://github.com/Aloso/lexical-sort) is currently
unmaintained. The author recommends switching to the `icu` crate which
is maintained by the Unicode Consortium.
This commit is contained in:
Josh Megnauth 2024-07-08 02:00:52 -04:00
parent 5ec14f86b3
commit 783256fe8b
No known key found for this signature in database
GPG key ID: 70813183462EFAD3
6 changed files with 622 additions and 28 deletions

View file

@ -94,6 +94,8 @@ impl MimeAppCache {
// Only available when using desktop feature of libcosmic, which only works on Unix-likes
#[cfg(feature = "desktop")]
pub fn reload(&mut self) {
use crate::localize::LANGUAGE_SORTER;
let start = Instant::now();
self.cache.clear();
@ -245,7 +247,7 @@ impl MimeAppCache {
apps.sort_by(|a, b| match (a.is_default, b.is_default) {
(true, false) => Ordering::Less,
(false, true) => Ordering::Greater,
_ => lexical_sort::natural_lexical_cmp(&a.name, &b.name),
_ => LANGUAGE_SORTER.compare(&a.name, &b.name),
});
}