- added a filter to the directory loader to remove EDuke32's texture cache files.

These cause problems with the texture manager.
This commit is contained in:
Christoph Oelckers 2021-04-14 22:12:15 +02:00
parent bc007d75de
commit f6c4c19b02

View file

@ -154,13 +154,28 @@ int FDirectory::AddDirectory(const char *dirpath)
}
else
{
if (strstr(fi, ".orig") || strstr(fi, ".bak"))
if (strstr(fi, ".orig") || strstr(fi, ".bak") || strstr(fi, ".cache"))
{
// We shouldn't add backup files to the file system
continue;
}
size_t size = 0;
FString fn = FString(dirpath) + fi;
// The next one is courtesy of EDuke32. :(
// Putting cache files in the application directory is very bad style.
// Unfortunately, having a garbage file named "texture" present will cause serious problems down the line.
if (!stricmp(fi, "textures"))
{
FILE* f = fopen(fn, "rb");
if (f)
{
char check[3]{};
fread(check, 1, 3, f);
if (!memcmp(check, "LZ4", 3)) continue;
}
}
if (GetFileInfo(fn, &size, nullptr))
{
AddEntry(fn, (int)size);