1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +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 * @size : size of path
* *
* Find last slash in path. Tries to find * Find last slash in path. Tries to find
* a backslash on Windows too which takes precedence * a backslash as used for Windows paths,
* over regular slash. * otherwise checks for a regular slash.
* @return pointer to last slash/backslash found in @str. * @return pointer to last slash/backslash found in @str.
**/ **/
char *find_last_slash(const char *str) char *find_last_slash(const char *str)
{ {
const char *slash = strrchr(str, '/'); const char *slash = strrchr(str, '/');
#ifdef _WIN32
const char *backslash = strrchr(str, '\\'); const char *backslash = strrchr(str, '\\');
if (!slash || (backslash > slash)) if (!slash || (backslash > slash))
return (char*)backslash; return (char*)backslash;
#endif else
return (char*)slash; return (char*)slash;
} }
/** /**