- Amend 9d84f92c0e to just do true case-insensitivity.

* adding /home/mrichters/.config/raze/Blood/sOuNdS.rFf, 1747 lumps
This commit is contained in:
Mitchell Richters 2020-10-14 20:18:53 +11:00
parent 9d84f92c0e
commit be42a6e28d

View file

@ -42,7 +42,6 @@
#include <unistd.h> #include <unistd.h>
#include <fnmatch.h> #include <fnmatch.h>
#include <sys/stat.h>
#include "cmdlib.h" #include "cmdlib.h"
@ -211,22 +210,38 @@ bool D_AddFile(TArray<FString>& wadfiles, const char* file, bool check, int posi
FString basepath = fullpath.Left(lastindex); FString basepath = fullpath.Left(lastindex);
FString filename = fullpath.Right(fullpath.Len() - lastindex - 1); FString filename = fullpath.Right(fullpath.Len() - lastindex - 1);
struct stat info; if (filename.IsNotEmpty())
bool res = stat(fullpath, &info) == 0;
if (!res)
{ {
filename.ToLower(); bool found = false;
fullpath = basepath << "/" << filename; DIR *d;
res = stat(fullpath, &info) == 0; struct dirent *dir;
if (!res) d = opendir(basepath.GetChars());
if (d)
{ {
filename.ToUpper(); while ((dir = readdir(d)) != NULL)
fullpath = basepath << "/" << filename; {
res = stat(fullpath, &info) == 0; if (filename.CompareNoCase(dir->d_name) == 0)
if (!res) fullpath = file; {
found = true;
filename = dir->d_name;
fullpath = basepath << "/" << filename;
file = fullpath.GetChars();
break;
}
}
closedir(d);
if (!found)
{
Printf("Can't find file '%s'\n", filename.GetChars());
return false;
}
}
else
{
Printf("Can't open directory '%s'\n", basepath.GetChars());
return false;
} }
} }
file = fullpath;
#endif #endif
if (check && !DirEntryExists(file)) if (check && !DirEntryExists(file))