mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 16:58:36 -07:00
Fix fap meta load hang
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include <toolbox/path.h>
|
#include <toolbox/path.h>
|
||||||
#include <flipper_application/flipper_application.h>
|
#include <flipper_application/flipper_application.h>
|
||||||
#include <loader/firmware_api/firmware_api.h>
|
#include <loader/firmware_api/firmware_api.h>
|
||||||
|
#include <storage/storage_processing.h>
|
||||||
|
|
||||||
#define TAG "FapLoader"
|
#define TAG "FapLoader"
|
||||||
|
|
||||||
@@ -30,6 +31,17 @@ bool fap_loader_load_name_and_icon(
|
|||||||
Storage* storage,
|
Storage* storage,
|
||||||
uint8_t** icon_ptr,
|
uint8_t** icon_ptr,
|
||||||
FuriString* item_name) {
|
FuriString* item_name) {
|
||||||
|
StorageData* storage_data;
|
||||||
|
if(storage_get_data(storage, path, &storage_data) == FSE_OK && storage_path_already_open(path, storage_data)) {
|
||||||
|
size_t offset = furi_string_search_rchar(path, '/');
|
||||||
|
if(offset != FURI_STRING_FAILURE) {
|
||||||
|
furi_string_set_n(item_name, path, offset + 1, furi_string_size(path) - offset - 1);
|
||||||
|
} else {
|
||||||
|
furi_string_set(item_name, path);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
FlipperApplication* app = flipper_application_alloc(storage, firmware_api_interface);
|
FlipperApplication* app = flipper_application_alloc(storage, firmware_api_interface);
|
||||||
|
|
||||||
FlipperApplicationPreloadStatus preload_res =
|
FlipperApplicationPreloadStatus preload_res =
|
||||||
@@ -46,6 +58,12 @@ bool fap_loader_load_name_and_icon(
|
|||||||
load_success = true;
|
load_success = true;
|
||||||
} else {
|
} else {
|
||||||
FURI_LOG_E(TAG, "FAP Loader failed to preload %s", furi_string_get_cstr(path));
|
FURI_LOG_E(TAG, "FAP Loader failed to preload %s", furi_string_get_cstr(path));
|
||||||
|
size_t offset = furi_string_search_rchar(path, '/');
|
||||||
|
if(offset != FURI_STRING_FAILURE) {
|
||||||
|
furi_string_set_n(item_name, path, offset + 1, furi_string_size(path) - offset - 1);
|
||||||
|
} else {
|
||||||
|
furi_string_set(item_name, path);
|
||||||
|
}
|
||||||
load_success = false;
|
load_success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ static bool xtreme_app_scene_interface_mainmenu_add_file_browser_callback(
|
|||||||
uint8_t** icon_ptr,
|
uint8_t** icon_ptr,
|
||||||
FuriString* item_name) {
|
FuriString* item_name) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
if(furi_string_end_with(file_path, app->fap_name)) return false;
|
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
bool success = fap_loader_load_name_and_icon(file_path, storage, icon_ptr, item_name);
|
bool success = fap_loader_load_name_and_icon(file_path, storage, icon_ptr, item_name);
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ void xtreme_app_free(XtremeApp* app) {
|
|||||||
extern int32_t xtreme_app(void* p) {
|
extern int32_t xtreme_app(void* p) {
|
||||||
UNUSED(p);
|
UNUSED(p);
|
||||||
XtremeApp* app = xtreme_app_alloc();
|
XtremeApp* app = xtreme_app_alloc();
|
||||||
snprintf(app->fap_name, 32, "%s.fap", furi_thread_get_appid(furi_thread_get_current_id()));
|
|
||||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneStart);
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneStart);
|
||||||
view_dispatcher_run(app->view_dispatcher);
|
view_dispatcher_run(app->view_dispatcher);
|
||||||
xtreme_app_free(app);
|
xtreme_app_free(app);
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
ARRAY_DEF(CharList, char*)
|
ARRAY_DEF(CharList, char*)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char fap_name[32];
|
|
||||||
Gui* gui;
|
Gui* gui;
|
||||||
DialogsApp* dialogs;
|
DialogsApp* dialogs;
|
||||||
NotificationApp* notification;
|
NotificationApp* notification;
|
||||||
|
|||||||
Reference in New Issue
Block a user