Skip to content

Commit

Permalink
Use path_get_extension_mutable
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Jan 16, 2025
1 parent 7e00668 commit 86c9a43
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libretro-common/file/file_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ const char *path_get_extension(const char *path)
char *path_get_extension_mutable(const char *path)
{
char *ext = NULL;
if (!string_is_empty(path) && ((ext = (char*)strrchr(path_basename(path), '.'))))
if ( !string_is_empty(path)
&& ((ext = (char*)strrchr(path_basename(path), '.'))))
return ext;
return NULL;
}
Expand All @@ -276,8 +277,7 @@ char *path_get_extension_mutable(const char *path)
**/
char *path_remove_extension(char *s)
{
char *last = !string_is_empty(s)
? (char*)strrchr(path_basename(s), '.') : NULL;
char *last = path_get_extension_mutable(s);
if (!last)
return NULL;
if (*last)
Expand Down
2 changes: 1 addition & 1 deletion menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -5145,7 +5145,7 @@ static unsigned menu_displaylist_parse_content_information(
settings->paths.path_content_database,
db_name,
sizeof(db_path));
last = (char*)strrchr(path_basename(db_path), '.');
last = path_get_extension_mutable(db_path);
if (*last)
{
last[0] = '.';
Expand Down
3 changes: 2 additions & 1 deletion runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -7856,7 +7856,8 @@ void runloop_path_set_basename(const char *path)
*/
path_basedir_wrapper(runloop_st->runtime_content_path_basename);
if (!string_is_empty(runloop_st->runtime_content_path_basename))
fill_pathname_dir(runloop_st->runtime_content_path_basename, path, "", sizeof(runloop_st->runtime_content_path_basename));
fill_pathname_dir(runloop_st->runtime_content_path_basename, path,
"", sizeof(runloop_st->runtime_content_path_basename));
#endif

if ((dst = strrchr(runloop_st->runtime_content_path_basename, '.')))
Expand Down

0 comments on commit 86c9a43

Please sign in to comment.