From db3ae29bd003c55495e26b3106af0bbdcf4863d3 Mon Sep 17 00:00:00 2001 From: summermorningdream <24917424+zxkmm@users.noreply.github.com> Date: Mon, 20 May 2024 15:02:29 +0800 Subject: [PATCH] fix flash util err when no `APPS` dir (#2155) * add path class usage * fix when don't have apps dir * clean up --- firmware/application/apps/ui_flash_utility.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/application/apps/ui_flash_utility.cpp b/firmware/application/apps/ui_flash_utility.cpp index bef97827..43bb51be 100644 --- a/firmware/application/apps/ui_flash_utility.cpp +++ b/firmware/application/apps/ui_flash_utility.cpp @@ -83,6 +83,7 @@ FlashUtilityView::FlashUtilityView(NavigationView& nav) menu_view.set_parent_rect({0, 3 * 8, 240, 33 * 8}); + ensure_directory(apps_dir); ensure_directory(firmware_dir); auto add_firmware_items = [&]( @@ -154,7 +155,7 @@ bool FlashUtilityView::flash_firmware(std::filesystem::path::string_type path) { if (path.empty() || !valid_firmware_file(path.c_str())) { painter.fill_rectangle({0, 50, portapack::display.width(), 90}, ui::Color::black()); - painter.draw_string({0, 60}, Styles::red, "BAD FIRMWARE FILE"); + painter.draw_string({0, 60}, Styles::red, "BAD FIRMWARE FILE OR W/R ERR"); chThdSleepMilliseconds(5000); return false; }