mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(archive_file) Don't know why this won't compile for MSVC -
<compat/posix_string.h> gets included which should redefine strtok_r for MSVC usage but it just doesn't work and fails at linking stage, will have to figure this out later
This commit is contained in:
parent
c02d8b8475
commit
f574a3a68e
@ -25,7 +25,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <file/archive_file.h>
|
||||
#include <file/file_path.h>
|
||||
#include <streams/file_stream.h>
|
||||
@ -56,43 +55,37 @@ static int file_archive_get_file_list_cb(
|
||||
|
||||
if (valid_exts)
|
||||
{
|
||||
char *tok, *save;
|
||||
bool found_ext = false;
|
||||
char *valid_exts_cpy = NULL;
|
||||
size_t path_len = 0;
|
||||
char last_char = 0;
|
||||
const char *file_ext = path_get_extension(path);
|
||||
|
||||
if (!file_ext)
|
||||
return 1;
|
||||
|
||||
path_len = strlen(path);
|
||||
last_char = path[path_len - 1];
|
||||
|
||||
size_t path_len = strlen(path);
|
||||
/* Checks if this entry is a directory or a file. */
|
||||
char last_char = path[path_len - 1];
|
||||
struct string_list ext_list = {0};
|
||||
|
||||
/* Skip if directory. */
|
||||
if (last_char == '/' || last_char == '\\')
|
||||
if (last_char == '/' || last_char == '\\' )
|
||||
return 1;
|
||||
|
||||
valid_exts_cpy = strdup(valid_exts);
|
||||
tok = strtok_r(valid_exts_cpy, "|", &save);
|
||||
|
||||
while (tok)
|
||||
string_list_initialize(&ext_list);
|
||||
if (string_split_noalloc(&ext_list, valid_exts, "|"))
|
||||
{
|
||||
if (string_is_equal_noncase(tok, file_ext))
|
||||
const char *file_ext = path_get_extension(path);
|
||||
|
||||
if (!file_ext)
|
||||
{
|
||||
found_ext = true;
|
||||
break;
|
||||
string_list_deinitialize(&ext_list);
|
||||
return 1;
|
||||
}
|
||||
tok = strtok_r(NULL, "|", &save);
|
||||
|
||||
if (!string_list_find_elem_prefix(&ext_list, ".", file_ext))
|
||||
{
|
||||
/* keep iterating */
|
||||
string_list_deinitialize(&ext_list);
|
||||
return -1;
|
||||
}
|
||||
|
||||
attr.i = RARCH_COMPRESSED_FILE_IN_ARCHIVE;
|
||||
}
|
||||
free(valid_exts_cpy);
|
||||
|
||||
/* keep iterating */
|
||||
if (!found_ext)
|
||||
return -1;
|
||||
|
||||
attr.i = RARCH_COMPRESSED_FILE_IN_ARCHIVE;
|
||||
string_list_deinitialize(&ext_list);
|
||||
}
|
||||
|
||||
return string_list_append(userdata->list, path, attr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user