[FL-2229] New assets paths (#978)

* assets: change resources paths
* apps: rework nfc, irda and subghz with new assets path
* subghz: remove unused paths
* subghz: fix incorrect path
* badusb and u2f fix

Co-authored-by: あく <alleteam@gmail.com>
Co-authored-by: nminaylov <nm29719@gmail.com>
This commit is contained in:
gornekich 2022-02-02 18:58:52 +03:00 committed by GitHub
parent d2c4f15af5
commit 838df4c9ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 28 additions and 40 deletions

View File

@ -8,7 +8,7 @@ static const char* tab_default_paths[] = {
[ArchiveTabFavorites] = "/any/favorites", [ArchiveTabFavorites] = "/any/favorites",
[ArchiveTabIButton] = "/any/ibutton", [ArchiveTabIButton] = "/any/ibutton",
[ArchiveTabNFC] = "/any/nfc", [ArchiveTabNFC] = "/any/nfc",
[ArchiveTabSubGhz] = "/any/subghz/saved", [ArchiveTabSubGhz] = "/any/subghz",
[ArchiveTabLFRFID] = "/any/lfrfid", [ArchiveTabLFRFID] = "/any/lfrfid",
[ArchiveTabIrda] = "/any/irda", [ArchiveTabIrda] = "/any/irda",
[ArchiveTabBrowser] = "/any", [ArchiveTabBrowser] = "/any",

View File

@ -19,7 +19,7 @@ void bad_usb_scene_file_select_on_enter(void* context) {
BadUsbApp* bad_usb = context; BadUsbApp* bad_usb = context;
if(bad_usb_file_select(bad_usb)) { if(bad_usb_file_select(bad_usb)) {
scene_manager_next_scene(bad_usb->scene_manager, BadUsbAppViewWork); scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneWork);
} else { } else {
//scene_manager_previous_scene(bad_usb->scene_manager); //scene_manager_previous_scene(bad_usb->scene_manager);
view_dispatcher_stop(bad_usb->view_dispatcher); view_dispatcher_stop(bad_usb->view_dispatcher);

View File

@ -159,7 +159,7 @@ class IrdaAppSceneUniversalTV : public IrdaAppSceneUniversalCommon {
public: public:
void on_enter(IrdaApp* app) final; void on_enter(IrdaApp* app) final;
IrdaAppSceneUniversalTV() IrdaAppSceneUniversalTV()
: IrdaAppSceneUniversalCommon("/ext/irda/universal/tv.ir") { : IrdaAppSceneUniversalCommon("/ext/irda/assets/tv.ir") {
} }
~IrdaAppSceneUniversalTV() { ~IrdaAppSceneUniversalTV() {
} }
@ -169,7 +169,7 @@ class IrdaAppSceneUniversalAudio : public IrdaAppSceneUniversalCommon {
public: public:
void on_enter(IrdaApp* app) final; void on_enter(IrdaApp* app) final;
IrdaAppSceneUniversalAudio() IrdaAppSceneUniversalAudio()
: IrdaAppSceneUniversalCommon("/ext/irda/universal/audio.ir") { : IrdaAppSceneUniversalCommon("/ext/irda/assets/audio.ir") {
} }
~IrdaAppSceneUniversalAudio() { ~IrdaAppSceneUniversalAudio() {
} }

View File

@ -44,7 +44,7 @@ bool nfc_emv_parser_get_aid_name(
for(uint8_t i = 0; i < aid_len; i++) { for(uint8_t i = 0; i < aid_len; i++) {
string_cat_printf(key, "%02X", aid[i]); string_cat_printf(key, "%02X", aid[i]);
} }
if(nfc_emv_parser_search_data(storage, "/ext/nfc/emv/aid.nfc", key, aid_name)) { if(nfc_emv_parser_search_data(storage, "/ext/nfc/assets/aid.nfc", key, aid_name)) {
parsed = true; parsed = true;
} }
string_clear(key); string_clear(key);
@ -58,7 +58,7 @@ bool nfc_emv_parser_get_country_name(
bool parsed = false; bool parsed = false;
string_t key; string_t key;
string_init_printf(key, "%04X", country_code); string_init_printf(key, "%04X", country_code);
if(nfc_emv_parser_search_data(storage, "/ext/nfc/emv/country_code.nfc", key, country_name)) { if(nfc_emv_parser_search_data(storage, "/ext/nfc/assets/country_code.nfc", key, country_name)) {
parsed = true; parsed = true;
} }
string_clear(key); string_clear(key);
@ -72,7 +72,8 @@ bool nfc_emv_parser_get_currency_name(
bool parsed = false; bool parsed = false;
string_t key; string_t key;
string_init_printf(key, "%04X", currency_code); string_init_printf(key, "%04X", currency_code);
if(nfc_emv_parser_search_data(storage, "/ext/nfc/emv/currency_code.nfc", key, currency_name)) { if(nfc_emv_parser_search_data(
storage, "/ext/nfc/assets/currency_code.nfc", key, currency_name)) {
parsed = true; parsed = true;
} }
string_clear(key); string_clear(key);

View File

@ -23,7 +23,7 @@ bool subghz_scene_read_raw_update_filename(SubGhz* subghz) {
path_extract_filename_no_ext(string_get_cstr(temp_str), temp_str); path_extract_filename_no_ext(string_get_cstr(temp_str), temp_str);
strcpy(subghz->file_name, string_get_cstr(temp_str)); strcpy(subghz->file_name, string_get_cstr(temp_str));
string_printf( string_printf(
temp_str, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION); temp_str, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION);
subghz_protocol_raw_set_last_file_name( subghz_protocol_raw_set_last_file_name(
(SubGhzProtocolRAW*)subghz->txrx->protocol_result, string_get_cstr(temp_str)); (SubGhzProtocolRAW*)subghz->txrx->protocol_result, string_get_cstr(temp_str));

View File

@ -39,7 +39,7 @@ void subghz_scene_save_name_on_enter(void* context) {
dev_name_empty); dev_name_empty);
ValidatorIsFile* validator_is_file = ValidatorIsFile* validator_is_file =
validator_is_file_alloc_init(SUBGHZ_APP_PATH_FOLDER, SUBGHZ_APP_EXTENSION); validator_is_file_alloc_init(SUBGHZ_APP_FOLDER, SUBGHZ_APP_EXTENSION);
text_input_set_validator(text_input, validator_is_file_callback, validator_is_file); text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewTextInput); view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewTextInput);

View File

@ -284,10 +284,10 @@ int32_t subghz_app(void* p) {
//Load database //Load database
bool load_database = bool load_database =
subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes"); subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/assets/keeloq_mfcodes");
subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes_user"); subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/assets/keeloq_mfcodes_user");
subghz_parser_load_nice_flor_s_file(subghz->txrx->parser, "/ext/subghz/nice_flor_s_rx"); subghz_parser_load_nice_flor_s_file(subghz->txrx->parser, "/ext/subghz/assets/nice_flor_s_rx");
subghz_parser_load_came_atomo_file(subghz->txrx->parser, "/ext/subghz/came_atomo"); subghz_parser_load_came_atomo_file(subghz->txrx->parser, "/ext/subghz/assets/came_atomo");
// Check argument and run corresponding scene // Check argument and run corresponding scene
if(p && subghz_key_load(subghz, p)) { if(p && subghz_key_load(subghz, p)) {

View File

@ -215,10 +215,10 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
furi_check(instance->stream); furi_check(instance->stream);
SubGhzParser* parser = subghz_parser_alloc(); SubGhzParser* parser = subghz_parser_alloc();
subghz_parser_load_keeloq_file(parser, "/ext/subghz/keeloq_mfcodes"); subghz_parser_load_keeloq_file(parser, "/ext/subghz/assets/keeloq_mfcodes");
subghz_parser_load_keeloq_file(parser, "/ext/subghz/keeloq_mfcodes_user"); subghz_parser_load_keeloq_file(parser, "/ext/subghz/assets/keeloq_mfcodes_user");
subghz_parser_load_nice_flor_s_file(parser, "/ext/subghz/nice_flor_s_rx"); subghz_parser_load_nice_flor_s_file(parser, "/ext/subghz/assets/nice_flor_s_rx");
subghz_parser_load_came_atomo_file(parser, "/ext/subghz/came_atomo"); subghz_parser_load_came_atomo_file(parser, "/ext/subghz/assets/came_atomo");
subghz_parser_enable_dump_text(parser, subghz_cli_command_rx_text_callback, instance); subghz_parser_enable_dump_text(parser, subghz_cli_command_rx_text_callback, instance);
// Configure radio // Configure radio

20
applications/subghz/subghz_i.c Normal file → Executable file
View File

@ -284,7 +284,7 @@ bool subghz_get_next_name_file(SubGhz* subghz) {
if(strcmp(subghz->file_name, "")) { if(strcmp(subghz->file_name, "")) {
//get the name of the next free file //get the name of the next free file
storage_get_next_filename( storage_get_next_filename(
storage, SUBGHZ_RAW_PATH_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION, temp_str); storage, SUBGHZ_RAW_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION, temp_str);
strcpy(subghz->file_name, string_get_cstr(temp_str)); strcpy(subghz->file_name, string_get_cstr(temp_str));
res = true; res = true;
@ -319,15 +319,9 @@ bool subghz_save_protocol_to_file(SubGhz* subghz, const char* dev_name) {
dialog_message_show_storage_error(subghz->dialogs, "Cannot create\nfolder"); dialog_message_show_storage_error(subghz->dialogs, "Cannot create\nfolder");
break; break;
} }
// Create saved directory if necessary
if(!storage_simply_mkdir(storage, SUBGHZ_APP_PATH_FOLDER)) {
dialog_message_show_storage_error(subghz->dialogs, "Cannot create\nfolder");
break;
}
// First remove subghz device file if it was saved // First remove subghz device file if it was saved
string_printf( string_printf(dev_file_name, "%s/%s%s", SUBGHZ_APP_FOLDER, dev_name, SUBGHZ_APP_EXTENSION);
dev_file_name, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, dev_name, SUBGHZ_APP_EXTENSION);
if(!storage_simply_remove(storage, string_get_cstr(dev_file_name))) { if(!storage_simply_remove(storage, string_get_cstr(dev_file_name))) {
break; break;
@ -386,7 +380,7 @@ bool subghz_load_protocol_from_file(SubGhz* subghz) {
// Input events and views are managed by file_select // Input events and views are managed by file_select
bool res = dialog_file_select_show( bool res = dialog_file_select_show(
subghz->dialogs, subghz->dialogs,
SUBGHZ_APP_PATH_FOLDER, SUBGHZ_APP_FOLDER,
SUBGHZ_APP_EXTENSION, SUBGHZ_APP_EXTENSION,
subghz->file_name, subghz->file_name,
sizeof(subghz->file_name), sizeof(subghz->file_name),
@ -394,7 +388,7 @@ bool subghz_load_protocol_from_file(SubGhz* subghz) {
if(res) { if(res) {
string_printf( string_printf(
file_name, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION); file_name, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION);
res = subghz_key_load(subghz, string_get_cstr(file_name)); res = subghz_key_load(subghz, string_get_cstr(file_name));
} }
@ -413,10 +407,10 @@ bool subghz_rename_file(SubGhz* subghz) {
Storage* storage = furi_record_open("storage"); Storage* storage = furi_record_open("storage");
string_init_printf( string_init_printf(
old_path, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name_tmp, SUBGHZ_APP_EXTENSION); old_path, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name_tmp, SUBGHZ_APP_EXTENSION);
string_init_printf( string_init_printf(
new_path, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION); new_path, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION);
FS_Error fs_result = FS_Error fs_result =
storage_common_rename(storage, string_get_cstr(old_path), string_get_cstr(new_path)); storage_common_rename(storage, string_get_cstr(old_path), string_get_cstr(new_path));
@ -439,7 +433,7 @@ bool subghz_delete_file(SubGhz* subghz) {
Storage* storage = furi_record_open("storage"); Storage* storage = furi_record_open("storage");
string_t file_path; string_t file_path;
string_init_printf( string_init_printf(
file_path, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name_tmp, SUBGHZ_APP_EXTENSION); file_path, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name_tmp, SUBGHZ_APP_EXTENSION);
bool result = storage_simply_remove(storage, string_get_cstr(file_path)); bool result = storage_simply_remove(storage, string_get_cstr(file_path));
furi_record_close("storage"); furi_record_close("storage");

View File

@ -8,8 +8,8 @@
#define TAG "U2F" #define TAG "U2F"
#define U2F_DATA_FOLDER "/any/u2f/" #define U2F_DATA_FOLDER "/any/u2f/"
#define U2F_CERT_FILE U2F_DATA_FOLDER "cert.der" #define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der"
#define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "cert_key.u2f" #define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f"
#define U2F_KEY_FILE U2F_DATA_FOLDER "key.u2f" #define U2F_KEY_FILE U2F_DATA_FOLDER "key.u2f"
#define U2F_CNT_FILE U2F_DATA_FOLDER "cnt.u2f" #define U2F_CNT_FILE U2F_DATA_FOLDER "cnt.u2f"

View File

@ -15,9 +15,7 @@
#define DURATION_DIFF(x, y) ((x < y) ? (y - x) : (x - y)) #define DURATION_DIFF(x, y) ((x < y) ? (y - x) : (x - y))
#define SUBGHZ_APP_FOLDER "/any/subghz" #define SUBGHZ_APP_FOLDER "/any/subghz"
#define SUBGHZ_APP_PATH_FOLDER "/any/subghz/saved"
#define SUBGHZ_RAW_FOLDER "/ext/subghz" #define SUBGHZ_RAW_FOLDER "/ext/subghz"
#define SUBGHZ_RAW_PATH_FOLDER "/ext/subghz/saved"
#define SUBGHZ_APP_EXTENSION ".sub" #define SUBGHZ_APP_EXTENSION ".sub"
#define SUBGHZ_ENCODER_UPLOAD_MAX_SIZE 2048 #define SUBGHZ_ENCODER_UPLOAD_MAX_SIZE 2048

7
lib/subghz/protocols/subghz_protocol_raw.c Normal file → Executable file
View File

@ -176,15 +176,10 @@ bool subghz_protocol_raw_save_to_file_init(
if(!storage_simply_mkdir(instance->storage, SUBGHZ_RAW_FOLDER)) { if(!storage_simply_mkdir(instance->storage, SUBGHZ_RAW_FOLDER)) {
break; break;
} }
// Create saved directory if necessary
if(!storage_simply_mkdir(instance->storage, SUBGHZ_RAW_PATH_FOLDER)) {
break;
}
string_set(instance->file_name, dev_name); string_set(instance->file_name, dev_name);
// First remove subghz device file if it was saved // First remove subghz device file if it was saved
string_printf( string_printf(dev_file_name, "%s/%s%s", SUBGHZ_RAW_FOLDER, dev_name, SUBGHZ_APP_EXTENSION);
dev_file_name, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, dev_name, SUBGHZ_APP_EXTENSION);
if(!storage_simply_remove(instance->storage, string_get_cstr(dev_file_name))) { if(!storage_simply_remove(instance->storage, string_get_cstr(dev_file_name))) {
break; break;