Skip to content

Commit 9381730

Browse files
storage_simply_mkdir added
Co-Authored-By: Augusto Zanellato <augusto.zanellato@gmail.com>
1 parent 458b1f4 commit 9381730

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

t5577_writer.c

+2-20
Original file line numberDiff line numberDiff line change
@@ -259,24 +259,6 @@ static void t5577_writer_edit_block_slc_change(VariableItem* item) {
259259
furi_string_free(buffer);
260260
}
261261

262-
void ensure_dir_exists(Storage* storage) {
263-
// If apps_data directory doesn't exist, create it.
264-
if(!storage_dir_exists(storage, T5577_WRITER_APPS_DATA_FOLDER)) {
265-
FURI_LOG_I(TAG, "Creating directory: %s", T5577_WRITER_APPS_DATA_FOLDER);
266-
storage_simply_mkdir(storage, T5577_WRITER_APPS_DATA_FOLDER);
267-
} else {
268-
FURI_LOG_I(TAG, "Directory exists: %s", T5577_WRITER_APPS_DATA_FOLDER);
269-
}
270-
271-
// If t5577_writer directory doesn't exist, create it.
272-
if(!storage_dir_exists(storage, T5577_WRITER_FILE_FOLDER)) {
273-
FURI_LOG_I(TAG, "Creating directory: %s", T5577_WRITER_FILE_FOLDER);
274-
storage_simply_mkdir(storage, T5577_WRITER_FILE_FOLDER);
275-
} else {
276-
FURI_LOG_I(TAG, "Directory exists: %s", T5577_WRITER_FILE_FOLDER);
277-
}
278-
}
279-
280262
static const char* tag_name_entry_text = "Enter name";
281263
static const char* tag_name_default_value = "Tag_1";
282264
static void t5577_writer_file_saver(void* context) {
@@ -302,7 +284,7 @@ static void t5577_writer_file_saver(void* context) {
302284
T5577_WRITER_FILE_EXTENSION);
303285

304286
Storage* storage = furi_record_open(RECORD_STORAGE);
305-
ensure_dir_exists(storage);
287+
storage_simply_mkdir(storage, STORAGE_APP_DATA_PATH_PREFIX);
306288
File* data_file = storage_file_alloc(storage);
307289
if(storage_file_open(
308290
data_file, furi_string_get_cstr(file_path), FSAM_WRITE, FSOM_OPEN_ALWAYS)) {
@@ -469,7 +451,7 @@ void t5577_writer_view_load_callback(void* context) {
469451
T5577WriterModel* model = view_get_model(app->view_write);
470452
DialogsFileBrowserOptions browser_options;
471453
Storage* storage = furi_record_open(RECORD_STORAGE);
472-
ensure_dir_exists(storage);
454+
storage_simply_mkdir(storage, STORAGE_APP_DATA_PATH_PREFIX);
473455
File* data_file = storage_file_alloc(storage);
474456
dialog_file_browser_set_basic_options(&browser_options, T5577_WRITER_FILE_EXTENSION, &I_icon);
475457
browser_options.base_path = T5577_WRITER_FILE_FOLDER;

0 commit comments

Comments
 (0)