Fix building file list on non-Windows platforms
This commit is contained in:
parent
982d4cc0f9
commit
512530c653
|
@ -645,13 +645,14 @@ int fileNameListInit(const char* pattern, char*** fileNameListPtr, int a3, int a
|
||||||
bool isWildcard = *pattern == '*';
|
bool isWildcard = *pattern == '*';
|
||||||
|
|
||||||
for (int index = 0; index < fileNamesLength; index += 1) {
|
for (int index = 0; index < fileNamesLength; index += 1) {
|
||||||
const char* name = xlist->fileNames[index];
|
char* name = xlist->fileNames[index];
|
||||||
char dir[COMPAT_MAX_DIR];
|
char dir[COMPAT_MAX_DIR];
|
||||||
char fileName[COMPAT_MAX_FNAME];
|
char fileName[COMPAT_MAX_FNAME];
|
||||||
char extension[COMPAT_MAX_EXT];
|
char extension[COMPAT_MAX_EXT];
|
||||||
|
compat_windows_path_to_native(name);
|
||||||
compat_splitpath(name, NULL, dir, fileName, extension);
|
compat_splitpath(name, NULL, dir, fileName, extension);
|
||||||
|
|
||||||
if (!isWildcard || *dir == '\0' || strchr(dir, '\\') == NULL) {
|
if (!isWildcard || *dir == '\0' || (strchr(dir, '\\') == NULL && strchr(dir, '/') == NULL)) {
|
||||||
// NOTE: Quick and dirty fix to buffer overflow. See RE to
|
// NOTE: Quick and dirty fix to buffer overflow. See RE to
|
||||||
// understand the problem.
|
// understand the problem.
|
||||||
char path[COMPAT_MAX_PATH];
|
char path[COMPAT_MAX_PATH];
|
||||||
|
|
Loading…
Reference in New Issue