[FL-1542], [FL-1603] Generate random name (#602)

* Lib: add random name library
* Text_input: add default text clearing
* All: rework all applications with new text_input API
* Nfc: fix removing dev file on save_name scene enter
* Lib: move all free radicals to toolbox and update API usage.

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-07-25 14:34:54 +03:00
committed by GitHub
parent 0c7a8edf51
commit ebd158a823
39 changed files with 142 additions and 132 deletions

20
lib/toolbox/path.c Normal file
View File

@@ -0,0 +1,20 @@
#include "path.h"
void path_extract_filename_no_ext(const char* path, string_t filename) {
string_set(filename, path);
size_t start_position = string_search_rchar(filename, '/');
size_t end_position = string_search_rchar(filename, '.');
if(start_position == STRING_FAILURE) {
start_position = 0;
} else {
start_position += 1;
}
if(end_position == STRING_FAILURE) {
end_position = string_size(filename);
}
string_mid(filename, start_position, end_position - start_position);
}