(file_path) fill_pathname_join_special - small tweak

This commit is contained in:
libretroadmin 2025-07-14 17:37:33 +02:00
parent 2d632fed54
commit 9b6641c951
1 changed files with 8 additions and 10 deletions

View File

@ -1005,19 +1005,17 @@ size_t fill_pathname_join_special(char *s,
const char *slash = strrchr(s, '/');
const char *backslash = strrchr(s, '\\');
char *last_slash = (!slash || (backslash > slash)) ? (char*)backslash : (char*)slash;
if (last_slash)
if (!last_slash)
{
/* Try to preserve slash type. */
if (last_slash != (s + _len - 1))
{
s[ _len] = last_slash[0];
s[++_len] = '\0';
}
s[ _len] = PATH_DEFAULT_SLASH_C();
s[++_len] = '\0';
}
else
/* Try to preserve slash type. */
else if (last_slash != (s + _len - 1))
{
s[ _len] = PATH_DEFAULT_SLASH_C();
s[++_len] = '\0';
s[ _len] = last_slash[0];
s[++_len] = '\0';
}
}