Fix SDL_EnumerateDirectory(/) failing on POSIX and Windows.
This commit is contained in:
committed by
Sam Lantinga
parent
6665ebaa2e
commit
09a2283b53
@@ -85,7 +85,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback
|
|||||||
|
|
||||||
// trim down to a single path separator at the end, in case the caller added one or more.
|
// trim down to a single path separator at the end, in case the caller added one or more.
|
||||||
pathwithseplen--;
|
pathwithseplen--;
|
||||||
while ((pathwithseplen >= 0) && (pathwithsep[pathwithseplen] == '/')) {
|
while ((pathwithseplen > 0) && (pathwithsep[pathwithseplen] == '/')) {
|
||||||
pathwithsep[pathwithseplen--] = '\0';
|
pathwithsep[pathwithseplen--] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback
|
|||||||
|
|
||||||
// trim down to a single path separator at the end, in case the caller added one or more.
|
// trim down to a single path separator at the end, in case the caller added one or more.
|
||||||
patternlen--;
|
patternlen--;
|
||||||
while ((patternlen >= 0) && ((pattern[patternlen] == '\\') || (pattern[patternlen] == '/'))) {
|
while ((patternlen > 0) && ((pattern[patternlen] == '\\') || (pattern[patternlen] == '/'))) {
|
||||||
pattern[patternlen--] ='\0';
|
pattern[patternlen--] ='\0';
|
||||||
}
|
}
|
||||||
pattern[++patternlen] = '\\';
|
pattern[++patternlen] = '\\';
|
||||||
|
|||||||
Reference in New Issue
Block a user