[FL-1931, FL-2005] SubGhz: migration in flipper file format (#807)
* SubGhz: add save key in flipper file format * [FL-2005] SubGhz: fix stored signals cannot be deleted * SubGhz: add load key in flipper file format * SubGhz: fix syntax * SubGhz: fix bad file upload * Storage: add function to get the next free filename * SubGhz: add save RAW in flipper file format * SubGhz: add load RAW in flipper file format * SubGhz: refactoring protocol * SubGhz: refactoring scene * SubGhz: fix SubGhzNotificationState define * Makefile: proper comapre for FORCE Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -463,3 +463,28 @@ bool storage_simply_mkdir(Storage* storage, const char* path) {
|
||||
result = storage_common_mkdir(storage, path);
|
||||
return result == FSE_OK || result == FSE_EXIST;
|
||||
}
|
||||
|
||||
void storage_get_next_filename(
|
||||
Storage* storage,
|
||||
const char* dirname,
|
||||
const char* filename,
|
||||
const char* fileextension,
|
||||
string_t nextfilename) {
|
||||
string_t temp_str;
|
||||
uint16_t num = 0;
|
||||
|
||||
string_init_printf(temp_str, "%s/%s%s", dirname, filename, fileextension);
|
||||
|
||||
while(storage_common_stat(storage, string_get_cstr(temp_str), NULL) == FSE_OK) {
|
||||
num++;
|
||||
string_printf(temp_str, "%s/%s%d%s", dirname, filename, num, fileextension);
|
||||
}
|
||||
|
||||
if(num) {
|
||||
string_printf(nextfilename, "%s%d", filename, num);
|
||||
} else {
|
||||
string_printf(nextfilename, "%s", filename);
|
||||
}
|
||||
|
||||
string_clear(temp_str);
|
||||
}
|
||||
|
@@ -262,6 +262,22 @@ bool storage_simply_remove_recursive(Storage* storage, const char* path);
|
||||
*/
|
||||
bool storage_simply_mkdir(Storage* storage, const char* path);
|
||||
|
||||
/**
|
||||
* @brief Get next free filename.
|
||||
*
|
||||
* @param storage
|
||||
* @param dirname
|
||||
* @param filename
|
||||
* @param fileextension
|
||||
* @param nextfilename return name
|
||||
*/
|
||||
void storage_get_next_filename(
|
||||
Storage* storage,
|
||||
const char* dirname,
|
||||
const char* filename,
|
||||
const char* fileextension,
|
||||
string_t nextfilename);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user