Skip to content

Commit

Permalink
Improvments
Browse files Browse the repository at this point in the history
  • Loading branch information
acegoal07 committed Apr 12, 2024
1 parent f0a0914 commit 50bcedf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scenes/nfc_playlist_scene_name_new_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ void nfc_playlist_name_new_file_menu_callback(void* context) {
NfcPlaylist* nfc_playlist = context;
Storage* storage = furi_record_open(RECORD_STORAGE);
FuriString* file_name = furi_string_alloc();

furi_string_printf(file_name, "/ext/apps_data/nfc_playlist/%s.txt", nfc_playlist->text_input_output);
FURI_LOG_I("Creating file: %s", furi_string_get_cstr(file_name));

if (!storage_common_exists(storage, furi_string_get_cstr(file_name))) {
File* file = storage_file_alloc(storage);
storage_file_open(file, furi_string_get_cstr(file_name), FSAM_READ_WRITE, FSOM_CREATE_NEW);
storage_file_close(file);
if (storage_file_open(file, furi_string_get_cstr(file_name), FSAM_READ_WRITE, FSOM_CREATE_NEW)) {
storage_file_close(file);
furi_string_move(nfc_playlist->settings.file_path, file_name);
}
storage_file_free(file);
}
furi_string_move(nfc_playlist->settings.file_path, file_name);

furi_string_free(file_name);
furi_record_close(RECORD_STORAGE);
scene_manager_previous_scene(nfc_playlist->scene_manager);
Expand Down
2 changes: 2 additions & 0 deletions scenes/nfc_playlist_scene_view_playlist_content.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ void nfc_playlist_view_playlist_content_scene_on_enter(void* context) {

furi_string_free(playlist_content);
storage_file_close(file);
} else {
widget_add_text_box_element(nfc_playlist->widget, 0, 0, 128, 64, AlignCenter, AlignCenter, "\eFailed to open playlist\n\nPress back\e", false);
}

storage_file_free(file);
Expand Down

0 comments on commit 50bcedf

Please sign in to comment.