From f96993493d68c02236ff9787abe66023bf90341c Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Mon, 3 Jul 2023 18:02:29 +0200 Subject: [PATCH] Fix small string usage bug --- applications/main/archive/helpers/archive_files.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/applications/main/archive/helpers/archive_files.c b/applications/main/archive/helpers/archive_files.c index cabb8f899..66d547886 100644 --- a/applications/main/archive/helpers/archive_files.c +++ b/applications/main/archive/helpers/archive_files.c @@ -18,25 +18,25 @@ void archive_set_file_type(ArchiveFile_t* file, const char* path, bool is_folder } else { for(size_t i = 0; i < COUNT_OF(known_ext); i++) { if((known_ext[i][0] == '?') || (known_ext[i][0] == '*')) continue; - if(furi_string_search(file->path, known_ext[i], 0) != FURI_STRING_FAILURE) { + if(furi_string_end_with_str(file->path, known_ext[i])) { // Check for .txt containing folder if(strcmp(known_ext[i], ".txt") == 0) { - const char* path = NULL; + const char* txt_path = NULL; switch(i) { case ArchiveFileTypeSubghzPlaylist: - path = PLAYLIST_FOLDER; + txt_path = PLAYLIST_FOLDER; break; case ArchiveFileTypeSubghzRemote: - path = SUBREM_APP_FOLDER; + txt_path = SUBREM_APP_FOLDER; break; case ArchiveFileTypeInfraredRemote: - path = IR_REMOTE_PATH; + txt_path = IR_REMOTE_PATH; break; case ArchiveFileTypeBadKb: - path = archive_get_default_path(ArchiveTabBadKb); + txt_path = archive_get_default_path(ArchiveTabBadKb); break; } - if(path != NULL && furi_string_search(file->path, path) == 0) { + if(txt_path != NULL && furi_string_start_with_str(file->path, txt_path)) { file->type = i; return; }