Use path_basename_nocompression where we are sure we are not

dealing with a filename with a compressed archive hash
This commit is contained in:
twinaphex 2021-04-11 17:44:41 +02:00
parent 637cff628f
commit 544a17926b
11 changed files with 21 additions and 18 deletions

View File

@ -705,7 +705,7 @@ static bool cheat_manager_get_game_specific_filename(
return false;
core_name = system_info.library_name;
game_name = path_basename(global->name.cheatfile);
game_name = path_basename_nocompression(global->name.cheatfile);
if (string_is_empty(path_cheat_database) ||
string_is_empty(core_name) ||

View File

@ -116,7 +116,7 @@ bool glslang_read_shader_file(const char *path,
if (string_is_empty(path) || !output)
return false;
basename = path_basename(path);
basename = path_basename_nocompression(path);
if (string_is_empty(basename))
return false;

View File

@ -272,7 +272,7 @@ bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data,
if (string_is_empty(playlist_path))
return true;
playlist_file = path_basename(playlist_path);
playlist_file = path_basename_nocompression(playlist_path);
/* Note: This is not considered an error
* (just means that input playlist is ignored) */
@ -811,7 +811,7 @@ bool gfx_thumbnail_get_content_dir(
tmp_buf[0] = '\0';
strlcpy(tmp_buf, path_data->content_path, path_length * sizeof(char));
strlcpy(content_dir, path_basename(tmp_buf), len);
strlcpy(content_dir, path_basename_nocompression(tmp_buf), len);
return !string_is_empty(content_dir);
}

View File

@ -1059,7 +1059,8 @@ static bool video_shader_write_referenced_preset(
/* If the initial preset loaded is the ever-changing retroarch
* preset don't save a reference
* TODO/FIXME - remove once we don't write this preset anymore */
if (!strncmp(path_basename(shader->loaded_preset_path), "retroarch",
if (!strncmp(path_basename_nocompression(shader->loaded_preset_path),
"retroarch",
STRLEN_CONST("retroarch")))
{
RARCH_WARN("[Shaders]: Saving Full Preset because we can't save"

View File

@ -352,7 +352,8 @@ bool gfx_widget_start_load_content_animation(void)
if (entry &&
!string_is_empty(entry->core_path))
{
const char *entry_core_file = path_basename(entry->core_path);
const char *entry_core_file = path_basename_nocompression(
entry->core_path);
/* Check whether core matches... */
if (string_is_empty(entry_core_file) ||

View File

@ -61,7 +61,7 @@ static int action_bind_label_playlist_collection_entry(
if (string_is_empty(path))
return 0;
playlist_file = path_basename(path);
playlist_file = path_basename_nocompression(path);
if (string_is_empty(playlist_file))
return 0;

View File

@ -2184,7 +2184,7 @@ static void materialui_refresh_playlist_icon_list(materialui_handle_t *mui,
if (string_is_empty(path))
continue;
playlist_file = path_basename(path);
playlist_file = path_basename_nocompression(path);
if (string_is_empty(playlist_file))
continue;
@ -2232,7 +2232,7 @@ static void materialui_set_node_playlist_icon(
if (string_is_empty(playlist_path))
return;
playlist_file = path_basename(playlist_path);
playlist_file = path_basename_nocompression(playlist_path);
if (string_is_empty(playlist_path))
return;

View File

@ -2420,7 +2420,7 @@ static void menu_displaylist_set_new_playlist(
const char *path, bool sort_enabled)
{
playlist_config_t playlist_config;
const char *playlist_file_name = path_basename(path);
const char *playlist_file_name = path_basename_nocompression(path);
int content_favorites_size = settings->ints.content_favorites_size;
unsigned content_history_size = settings->uints.content_history_size;
bool playlist_sort_alphabetical = settings->bools.playlist_sort_alphabetical;
@ -2936,7 +2936,7 @@ static int menu_displaylist_parse_horizontal_content_actions(
if (!string_is_empty(playlist_path))
{
const char *playlist_file = path_basename(playlist_path);
const char *playlist_file = path_basename_nocompression(playlist_path);
if (!string_is_empty(playlist_file))
remove_entry_enabled = string_is_equal(playlist_file, FILE_PATH_CONTENT_HISTORY) ||
@ -3259,7 +3259,7 @@ static unsigned menu_displaylist_parse_playlists(
if (string_is_empty(path))
continue;
playlist_file = path_basename(path);
playlist_file = path_basename_nocompression(path);
if (string_is_empty(playlist_file))
continue;
@ -3514,7 +3514,7 @@ static unsigned menu_displaylist_parse_playlist_manager_list(
if (string_is_empty(path))
continue;
playlist_file = path_basename(path);
playlist_file = path_basename_nocompression(path);
if (string_is_empty(playlist_file))
continue;
@ -3589,7 +3589,7 @@ static bool menu_displaylist_parse_playlist_manager_settings(
if (string_is_empty(playlist_path))
return false;
playlist_file = path_basename(playlist_path);
playlist_file = path_basename_nocompression(playlist_path);
if (string_is_empty(playlist_file))
return false;

View File

@ -2626,7 +2626,7 @@ bool playlist_index_is_valid(playlist_t *playlist, size_t idx,
return false;
return string_is_equal(playlist->entries[idx].path, path) &&
string_is_equal(path_basename(playlist->entries[idx].core_path), path_basename(core_path));
string_is_equal(path_basename_nocompression(playlist->entries[idx].core_path), path_basename_nocompression(core_path));
}
bool playlist_entries_are_equal(
@ -2696,7 +2696,7 @@ void playlist_get_db_name(playlist_t *playlist, size_t idx,
*db_name = playlist->entries[idx].db_name;
else
{
const char *conf_path_basename = path_basename(playlist->config.path);
const char *conf_path_basename = path_basename_nocompression(playlist->config.path);
/* Only use file basename if this is a 'collection' playlist
* (i.e. ignore history/favourites) */

View File

@ -166,7 +166,7 @@ static void input_autoconfigure_set_config_file(
/* > Extract config file path + name */
if (!string_is_empty(config->path))
{
const char *config_file_name = path_basename(config->path);
const char *config_file_name = path_basename_nocompression(config->path);
strlcpy(autoconfig_handle->device_info.config_path,
config->path,

View File

@ -489,7 +489,8 @@ bool task_push_pl_thumbnail_download(
string_is_empty(dir_thumbnails))
goto error;
playlist_file = path_basename(playlist_config->path);
playlist_file = path_basename_nocompression(
playlist_config->path);
if (string_is_empty(playlist_file))
goto error;