Fix build and cleanup

This commit is contained in:
Willy-JL
2024-04-05 22:00:34 +01:00
parent 0290996bea
commit 8e57a4f089
2 changed files with 8 additions and 11 deletions

View File

@@ -62,7 +62,6 @@ static void
#endif
static void desktop_scene_main_open_app_or_profile(Desktop* desktop, FavoriteApp* application) {
bool load_ok = false;
if(strlen(application->name_or_path) > 0) {
loader_start_detached_with_gui_error(desktop->loader, application->name_or_path, NULL);
} else {
@@ -72,7 +71,7 @@ static void desktop_scene_main_open_app_or_profile(Desktop* desktop, FavoriteApp
static void desktop_scene_main_start_favorite(Desktop* desktop, FavoriteApp* application) {
if(strlen(application->name_or_path) > 0) {
loader_start_detached_with_gui_error(desktop->loader, application->name_or_path);
loader_start_detached_with_gui_error(desktop->loader, application->name_or_path, NULL);
} else {
loader_start_detached_with_gui_error(desktop->loader, LOADER_APPLICATIONS_NAME, NULL);
}

View File

@@ -47,7 +47,13 @@ LoaderStatus
return result.value;
}
static void loader_show_gui_error(LoaderStatus status, FuriString* error_message) {
LoaderStatus loader_start_with_gui_error(Loader* loader, const char* name, const char* args) {
furi_check(loader);
furi_check(name);
FuriString* error_message = furi_string_alloc();
LoaderStatus status = loader_start(loader, name, args, error_message);
if(status == LoaderStatusErrorUnknownApp &&
loader_find_external_application_by_name(name) != NULL) {
// Special case for external apps
@@ -81,15 +87,7 @@ static void loader_show_gui_error(LoaderStatus status, FuriString* error_message
dialog_message_free(message);
furi_record_close(RECORD_DIALOGS);
}
}
LoaderStatus loader_start_with_gui_error(Loader* loader, const char* name, const char* args) {
furi_check(loader);
furi_check(name);
FuriString* error_message = furi_string_alloc();
LoaderStatus status = loader_start(loader, name, args, error_message);
loader_show_gui_error(status, error_message);
furi_string_free(error_message);
return status;
}