Просмотр исходного кода

fixed IR Import when empty, add hint when empty

rdefeo 1 год назад
Родитель
Сommit
f848547c85
2 измененных файлов с 8 добавлено и 3 удалено
  1. 7 2
      scenes/scene_action_ir_list.c
  2. 1 1
      scenes/scene_items.c

+ 7 - 2
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 <flipper_format/flipper_format.h>
@@ -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));

+ 1 - 1
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>",
+            "<Empty, Hold Right>",
             EMPTY_ACTION_INDEX,
             scene_items_item_callback,
             ActionMenuItemTypeGroup,