1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00

Allow all systems to check for backslashes (Windows) as last slash in path. Improves portable core logic (#15612)

This commit is contained in:
Ryunam 2023-08-17 23:15:42 +02:00 committed by GitHub
parent 24287b1cce
commit c5c86fe5e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,21 +347,20 @@ size_t fill_pathname(char *out_path, const char *in_path,
* @size : size of path
*
* Find last slash in path. Tries to find
* a backslash on Windows too which takes precedence
* over regular slash.
* a backslash as used for Windows paths,
* otherwise checks for a regular slash.
* @return pointer to last slash/backslash found in @str.
**/
char *find_last_slash(const char *str)
{
const char *slash = strrchr(str, '/');
#ifdef _WIN32
const char *backslash = strrchr(str, '\\');
if (!slash || (backslash > slash))
return (char*)backslash;
#endif
return (char*)slash;
else
return (char*)slash;
}
/**