From 0cac10a2f0e51837b5ca954142f62b4882030a9d Mon Sep 17 00:00:00 2001 From: Adubbz Date: Wed, 8 Jul 2020 13:06:21 +1000 Subject: [PATCH] daybreak: sort folders alphabetically and only display success message on success (#1075) (cherry picked from commit f6893b1fff4219d81a6ecc87361fb383096fc990) --- troposphere/daybreak/source/ui.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/troposphere/daybreak/source/ui.cpp b/troposphere/daybreak/source/ui.cpp index b47437740..d055efbaf 100644 --- a/troposphere/daybreak/source/ui.cpp +++ b/troposphere/daybreak/source/ui.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include #include #include @@ -382,6 +383,12 @@ namespace dbk { /* Close the directory. */ closedir(dir); + + /* Sort the file entries. */ + std::sort(m_file_entries.begin(), m_file_entries.end(), [](const FileEntry &a, const FileEntry &b) { + return strncmp(a.name, b.name, sizeof(a.name)) < 0; + }); + return 0; } @@ -866,10 +873,11 @@ namespace dbk { /* Apply the prepared update. */ if (R_FAILED(rc = amssuApplyPreparedUpdate())) { this->LogText("Failed to apply update.\nResult: 0x%08x\n", rc); + } else { + /* Log success. */ + this->LogText("Update applied successfully.\n"); } - /* Log success. */ - this->LogText("Update applied successfully.\n"); this->MarkForReboot(); return rc; }