mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +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:
parent
24287b1cce
commit
c5c86fe5e8
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user