[FL-1537] NFC launch from archive (#580)

* archive: pass full file path as App argument
* nfc: add starting emulation from Archive
* nfc, ibutton: rework setting key name with path lib
* archive: revert launching app with full file path

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-07-16 00:39:21 +03:00
committed by GitHub
parent 851a44dc59
commit a837bc5d00
4 changed files with 28 additions and 14 deletions

View File

@@ -3,6 +3,7 @@
#include <callback-connector.h>
#include <m-string.h>
#include <file-worker-cpp.h>
#include <path.h>
const char* iButtonApp::app_folder = "ibutton";
const char* iButtonApp::app_extension = ".ibtn";
@@ -325,17 +326,10 @@ bool iButtonApp::load_key(const char* key_name) {
string_t key_path;
string_init_set_str(key_path, key_name);
if(!string_start_with_str_p(key_path, app_folder) ||
!string_end_with_str_p(key_path, app_extension)) {
string_clear(key_path);
return false;
}
result = load_key_data(key_path);
if(result) {
uint8_t folder_end = strlen(app_folder) + 1;
uint8_t extension_start = string_size(key_path) - strlen(app_extension);
string_mid(key_path, folder_end, extension_start - folder_end);
path_extract_filename_no_ext(key_name, key_path);
get_key()->set_name(string_get_cstr(key_path));
}
string_clear(key_path);