Skip to content

Commit

Permalink
Move back to "badusb" folder for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Mar 14, 2024
1 parent 7e8ac28 commit e69a6c0
Show file tree
Hide file tree
Showing 37 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bool file_browser_scene_start_on_event(void* context, SceneManagerEvent event) {
bool consumed = false;

if(event.type == SceneManagerEventTypeCustom) {
furi_string_set(app->file_path, ANY_PATH("badkb/demo_windows.txt"));
furi_string_set(app->file_path, ANY_PATH("badusb/demo_windows.txt"));
scene_manager_next_scene(app->scene_manager, FileBrowserSceneBrowser);
consumed = true;
} else if(event.type == SceneManagerEventTypeTick) {
Expand Down
2 changes: 1 addition & 1 deletion applications/external
2 changes: 1 addition & 1 deletion applications/main/archive/helpers/archive_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static const char* tab_default_paths[] = {
[ArchiveTabSubGhz] = EXT_PATH("subghz"),
[ArchiveTabLFRFID] = EXT_PATH("lfrfid"),
[ArchiveTabInfrared] = EXT_PATH("infrared"),
[ArchiveTabBadKb] = EXT_PATH("badkb"),
[ArchiveTabBadKb] = EXT_PATH("badusb"),
[ArchiveTabU2f] = "/app:u2f",
[ArchiveTabApplications] = EXT_PATH("apps"),
[ArchiveTabSearch] = "/app:search",
Expand Down
2 changes: 1 addition & 1 deletion applications/main/bad_kb/bad_kb_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static void bad_kb_app_tick_event_callback(void* context) {
scene_manager_handle_tick_event(app->scene_manager);
}

static void bad_kb_load_settings(BadKbApp* app) {
void bad_kb_load_settings(BadKbApp* app) {
furi_string_reset(app->keyboard_layout);
BadKbConfig* cfg = &app->config;

Expand Down
2 changes: 2 additions & 0 deletions applications/main/bad_kb/bad_kb_app_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ typedef enum {

void bad_kb_app_show_loading_popup(BadKbApp* app, bool show);

void bad_kb_load_settings(BadKbApp* app);

int32_t bad_kb_conn_apply(BadKbApp* app);

void bad_kb_conn_reset(BadKbApp* app);
Expand Down
2 changes: 1 addition & 1 deletion applications/main/bad_kb/bad_kb_paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <storage/storage.h>

#define BAD_KB_APP_BASE_FOLDER EXT_PATH("badkb")
#define BAD_KB_APP_BASE_FOLDER EXT_PATH("badusb")
#define BAD_KB_KEYS_PATH BAD_KB_APP_BASE_FOLDER "/.badkb.keys"
#define BAD_KB_SETTINGS_PATH BAD_KB_APP_BASE_FOLDER "/.badkb.settings"
#define BAD_KB_APP_PATH_LAYOUT_FOLDER BAD_KB_APP_BASE_FOLDER "/assets/layouts"
18 changes: 12 additions & 6 deletions applications/main/bad_kb/scenes/bad_kb_scene_file_select.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ static bool bad_kb_file_select(BadKbApp* bad_kb) {

bad_kb_app_show_loading_popup(bad_kb, true);
Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_dir_exists(storage, EXT_PATH("badusb"))) {
if(storage_dir_exists(storage, EXT_PATH("badkb"))) {
DialogMessage* message = dialog_message_alloc();
dialog_message_set_header(message, "Migrate BadUSB?", 64, 0, AlignCenter, AlignTop);
dialog_message_set_header(message, "Migrate Scripts?", 64, 0, AlignCenter, AlignTop);
dialog_message_set_buttons(message, "No", NULL, "Yes");
dialog_message_set_text(
message,
"A badusb folder was found!\n"
"Momentum uses the badkb folder.\n"
"Want to transfer the files?",
"Momentum uses the 'badusb'\n"
"folder for compatibility.\n"
"Want to migrate from\n"
"'badkb' folder?",
64,
32,
AlignCenter,
Expand All @@ -25,7 +26,12 @@ static bool bad_kb_file_select(BadKbApp* bad_kb) {
dialog_message_free(message);
furi_record_close(RECORD_DIALOGS);
if(res == DialogMessageButtonRight) {
storage_common_migrate(storage, EXT_PATH("badusb"), BAD_KB_APP_BASE_FOLDER);
storage_common_migrate(storage, EXT_PATH("badkb"), BAD_KB_APP_BASE_FOLDER);
if(bad_kb->conn_init_thread) {
furi_thread_join(bad_kb->conn_init_thread);
}
bad_kb_load_settings(bad_kb);
bad_kb_config_adjust(&bad_kb->config);
}
}
storage_simply_mkdir(storage, BAD_KB_APP_BASE_FOLDER);
Expand Down

0 comments on commit e69a6c0

Please sign in to comment.