Skip to content

Commit

Permalink
Use path_basename_nocompression where we are sure we are not
Browse files Browse the repository at this point in the history
dealing with a filename with a compressed archive hash
  • Loading branch information
inactive123 committed Apr 11, 2021
1 parent 637cff6 commit 544a179
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cheat_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down
2 changes: 1 addition & 1 deletion gfx/drivers_shader/glslang_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions gfx/gfx_thumbnail_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down Expand Up @@ -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);
}
3 changes: 2 additions & 1 deletion gfx/video_shader_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion gfx/widgets/gfx_widget_load_content_animation.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down
2 changes: 1 addition & 1 deletion menu/cbs/menu_cbs_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions menu/drivers/materialui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) ||
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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) */
Expand Down
2 changes: 1 addition & 1 deletion tasks/task_autodetect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion tasks/task_pl_thumbnail_download.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 544a179

Please sign in to comment.