From 2a51958d776a49e761f732f889ce494eddbb4f04 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Tue, 14 Mar 2023 02:56:26 +0000 Subject: [PATCH] Sort apps and files by display name --- applications/main/archive/helpers/archive_files.h | 4 +++- applications/services/gui/modules/file_browser.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/applications/main/archive/helpers/archive_files.h b/applications/main/archive/helpers/archive_files.h index 431c701b3..e4bed3a63 100644 --- a/applications/main/archive/helpers/archive_files.h +++ b/applications/main/archive/helpers/archive_files.h @@ -93,7 +93,9 @@ static int ArchiveFile_t_cmp(const ArchiveFile_t* a, const ArchiveFile_t* b) { } } - return furi_string_cmpi(a->path, b->path); + return furi_string_cmpi( + furi_string_empty(a->custom_name) ? a->path : a->custom_name, + furi_string_empty(b->custom_name) ? b->path : b->custom_name); } #define M_OPL_ArchiveFile_t() \ diff --git a/applications/services/gui/modules/file_browser.c b/applications/services/gui/modules/file_browser.c index 841afda50..47bf89079 100644 --- a/applications/services/gui/modules/file_browser.c +++ b/applications/services/gui/modules/file_browser.c @@ -100,7 +100,7 @@ static int BrowserItem_t_cmp(const BrowserItem_t* a, const BrowserItem_t* b) { } } - return furi_string_cmpi(a->path, b->path); + return furi_string_cmpi(a->display_name, b->display_name); } #define M_OPL_BrowserItem_t() \