mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Use path_is_valid instead of filestream_exists when we only
need to know if a file exists on the filesystem
This commit is contained in:
parent
627c86721f
commit
2c47d571aa
@ -3215,6 +3215,8 @@ bool config_load_override(void)
|
||||
file_path_str(FILE_PATH_CONFIG_EXTENSION),
|
||||
path_size);
|
||||
|
||||
free(config_directory);
|
||||
|
||||
/* per-core overrides */
|
||||
/* Create a new config file from core_path */
|
||||
new_conf = config_file_read(core_path);
|
||||
@ -3335,7 +3337,6 @@ bool config_load_override(void)
|
||||
path_clear(RARCH_PATH_CONFIG_APPEND);
|
||||
|
||||
free(buf);
|
||||
free(config_directory);
|
||||
free(core_path);
|
||||
free(content_path);
|
||||
free(game_path);
|
||||
@ -3343,7 +3344,6 @@ bool config_load_override(void)
|
||||
|
||||
error:
|
||||
free(buf);
|
||||
free(config_directory);
|
||||
free(core_path);
|
||||
free(content_path);
|
||||
free(game_path);
|
||||
|
51
core_info.c
51
core_info.c
@ -584,7 +584,7 @@ static bool core_info_list_update_missing_firmware_internal(
|
||||
|
||||
fill_pathname_join(path, systemdir,
|
||||
info->firmware[i].path, path_size);
|
||||
info->firmware[i].missing = !filestream_exists(path);
|
||||
info->firmware[i].missing = !path_is_valid(path);
|
||||
if (info->firmware[i].missing && !info->firmware[i].optional)
|
||||
{
|
||||
*set_missing_bios = true;
|
||||
@ -596,55 +596,6 @@ static bool core_info_list_update_missing_firmware_internal(
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int core_info_firmware_cmp(const void *a_, const void *b_)
|
||||
{
|
||||
const core_info_firmware_t *a = (const core_info_firmware_t*)a_;
|
||||
const core_info_firmware_t *b = (const core_info_firmware_t*)b_;
|
||||
int order = b->missing - a->missing;
|
||||
|
||||
if (order)
|
||||
return order;
|
||||
return strcasecmp(a->path, b->path);
|
||||
}
|
||||
|
||||
/* Non-reentrant, does not allocate. Returns pointer to internal state. */
|
||||
|
||||
static void core_info_list_get_missing_firmware(
|
||||
core_info_list_t *core_info_list,
|
||||
const char *core, const char *systemdir,
|
||||
const core_info_firmware_t **firmware, size_t *num_firmware)
|
||||
{
|
||||
size_t i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
core_info_t *info = NULL;
|
||||
|
||||
if (!core_info_list || !core)
|
||||
return;
|
||||
|
||||
path[0] = '\0';
|
||||
*firmware = NULL;
|
||||
*num_firmware = 0;
|
||||
info = core_info_find_internal(core_info_list, core);
|
||||
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
*firmware = info->firmware;
|
||||
|
||||
for (i = 1; i < info->firmware_count; i++)
|
||||
{
|
||||
fill_pathname_join(path, systemdir,
|
||||
info->firmware[i].path, sizeof(path));
|
||||
info->firmware[i].missing = !filestream_exists(path);
|
||||
*num_firmware += info->firmware[i].missing;
|
||||
}
|
||||
|
||||
qsort(info->firmware, info->firmware_count, sizeof(*info->firmware),
|
||||
core_info_firmware_cmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
void core_info_free_current_core(void)
|
||||
{
|
||||
if (core_info_current)
|
||||
|
@ -315,7 +315,7 @@ static const char *font_renderer_ft_get_default_font(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (filestream_exists(font_paths[i]))
|
||||
if (path_is_valid(font_paths[i]))
|
||||
return font_paths[i];
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ static const char *font_renderer_stb_get_default_font(void)
|
||||
const char **p;
|
||||
|
||||
for (p = paths; *p; ++p)
|
||||
if (filestream_exists(*p))
|
||||
if (path_is_valid(*p))
|
||||
return *p;
|
||||
|
||||
return NULL;
|
||||
|
@ -314,7 +314,7 @@ static const char *font_renderer_stb_unicode_get_default_font(void)
|
||||
const char **p;
|
||||
|
||||
for (p = paths; *p; ++p)
|
||||
if (filestream_exists(*p))
|
||||
if (path_is_valid(*p))
|
||||
return *p;
|
||||
|
||||
return NULL;
|
||||
|
@ -152,7 +152,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
|
||||
strlcpy(tmp_path, tmp_str, path_size);
|
||||
path_resolve_realpath(tmp_path, path_size);
|
||||
|
||||
if (!filestream_exists(tmp_path))
|
||||
if (!path_is_valid(tmp_path))
|
||||
strlcpy(pass->source.path, tmp_str, sizeof(pass->source.path));
|
||||
else
|
||||
strlcpy(pass->source.path, tmp_path, sizeof(pass->source.path));
|
||||
@ -368,7 +368,7 @@ static bool video_shader_parse_textures(config_file_t *conf,
|
||||
path_size);
|
||||
path_resolve_realpath(tmp_path, path_size);
|
||||
|
||||
if (filestream_exists(tmp_path))
|
||||
if (path_is_valid(tmp_path))
|
||||
strlcpy(shader->lut[shader->luts].path,
|
||||
tmp_path, sizeof(shader->lut[shader->luts].path));
|
||||
free(tmp_path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user