From f848547c856abcf0a3d162e8738b8efe67d37458 Mon Sep 17 00:00:00 2001 From: rdefeo Date: Fri, 19 Jul 2024 00:05:34 -0400 Subject: [PATCH] fixed IR Import when empty, add hint when empty --- scenes/scene_action_ir_list.c | 9 +++++++-- scenes/scene_items.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scenes/scene_action_ir_list.c b/scenes/scene_action_ir_list.c index 9e2f1cb..d8380ac 100644 --- a/scenes/scene_action_ir_list.c +++ b/scenes/scene_action_ir_list.c @@ -8,6 +8,7 @@ #include "quac.h" #include "scenes.h" #include "scene_action_ir_list.h" +#include "../actions/action.h" #include "../actions/action_ir_utils.h" #include @@ -78,8 +79,12 @@ bool scene_action_ir_list_on_event(void* context, SceneManagerEvent event) { flipper_format_file_close(fff_data_file); // generate the new path, based on current item's dir and new command name - Item* item = ItemArray_get(app->items_view->items, app->selected_item); - path_extract_dirname(furi_string_get_cstr(item->path), file_name); + if(app->selected_item != EMPTY_ACTION_INDEX) { + Item* item = ItemArray_get(app->items_view->items, app->selected_item); + path_extract_dirname(furi_string_get_cstr(item->path), file_name); + } else { + furi_string_set(file_name, app->items_view->path); + } furi_string_cat_printf(file_name, "/%s.ir", furi_string_get_cstr(name)); FURI_LOG_I(TAG, "Writing new IR file: %s", furi_string_get_cstr(file_name)); diff --git a/scenes/scene_items.c b/scenes/scene_items.c index d433219..5fa7673 100644 --- a/scenes/scene_items.c +++ b/scenes/scene_items.c @@ -75,7 +75,7 @@ void scene_items_on_enter(void* context) { // Add a bogus item - this lets the user still access the Action menu to import, etc action_menu_add_item( menu, - "", + "", EMPTY_ACTION_INDEX, scene_items_item_callback, ActionMenuItemTypeGroup,