mirror of
https://github.com/libretro/RetroArch
synced 2025-03-01 16:13:40 +00:00
Fix incorrect file names for remap files when the content path doesn't have a preceding slash. (#13385)
This commit is contained in:
parent
77e202fbf7
commit
e5215d9e29
@ -407,15 +407,29 @@ bool fill_pathname_parent_dir_name(char *out_dir,
|
||||
last = find_last_slash(temp);
|
||||
}
|
||||
|
||||
/* Cut the last part of the string (the filename) after the slash,
|
||||
leaving the directory name (or nested directory names) only. */
|
||||
if (last)
|
||||
*last = '\0';
|
||||
|
||||
/* Point in_dir to the address of the last slash. */
|
||||
in_dir = find_last_slash(temp);
|
||||
|
||||
/* If find_last_slash returns NULL, it means there was no slash in temp,
|
||||
so use temp as-is. */
|
||||
if (!in_dir)
|
||||
in_dir = temp;
|
||||
|
||||
success = in_dir && in_dir[1];
|
||||
|
||||
if (success)
|
||||
strlcpy(out_dir, in_dir + 1, size);
|
||||
{
|
||||
/* If path starts with an slash, eliminate it. */
|
||||
if (path_is_absolute(in_dir))
|
||||
strlcpy(out_dir, in_dir + 1, size);
|
||||
else
|
||||
strlcpy(out_dir, in_dir, size);
|
||||
}
|
||||
|
||||
free(temp);
|
||||
return success;
|
||||
|
Loading…
x
Reference in New Issue
Block a user