1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-20 13:54:14 +01:00

Changed FindFirstFile code in LookForVDFs to look for *.vdf instead of *.*

This commit is contained in:
Scott Ehlert 2008-11-19 01:14:16 -06:00
parent 08a462ac61
commit d19cedd4eb
2 changed files with 10 additions and 24 deletions

View File

@ -704,17 +704,19 @@ void LoadFromVDF(const char *file)
void LookForVDFs(const char *dir)
{
char path[MAX_PATH];
int extidx;
#if defined _MSC_VER
HANDLE hFind;
WIN32_FIND_DATA fd;
char error[255];
g_SmmAPI.PathFormat(path, sizeof(path), "%s\\*.*", dir);
g_SmmAPI.PathFormat(path, sizeof(path), "%s\\*.vdf", dir);
if ((hFind = FindFirstFile(path, &fd)) == INVALID_HANDLE_VALUE)
{
DWORD dw = GetLastError();
if (dw == ERROR_FILE_NOT_FOUND)
return;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dw,
@ -728,16 +730,6 @@ void LookForVDFs(const char *dir)
do
{
if (strcmp(fd.cFileName, ".") == 0
|| strcmp(fd.cFileName, "..") == 0)
{
continue;
}
extidx = strlen(fd.cFileName) - 4;
if (extidx < 0 || stricmp(&fd.cFileName[extidx], ".vdf"))
{
continue;
}
g_SmmAPI.PathFormat(path, sizeof(path), "%s\\%s", dir, fd.cFileName);
LoadFromVDF(path);
} while (FindNextFile(hFind, &fd));
@ -746,6 +738,7 @@ void LookForVDFs(const char *dir)
#else
DIR *pDir;
struct dirent *pEnt;
int extidx;
if ((pDir = opendir(dir)) == NULL)
{

View File

@ -1436,17 +1436,19 @@ static void
LookForVDFs(const char *dir)
{
char path[MAX_PATH];
int extidx;
#if defined _MSC_VER
HANDLE hFind;
WIN32_FIND_DATA fd;
char error[255];
g_Metamod.PathFormat(path, sizeof(path), "%s\\*.*", dir);
g_Metamod.PathFormat(path, sizeof(path), "%s\\*.vdf", dir);
if ((hFind = FindFirstFile(path, &fd)) == INVALID_HANDLE_VALUE)
{
DWORD dw = GetLastError();
if (dw == ERROR_FILE_NOT_FOUND)
return;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dw,
@ -1460,16 +1462,6 @@ LookForVDFs(const char *dir)
do
{
if (strcmp(fd.cFileName, ".") == 0
|| strcmp(fd.cFileName, "..") == 0)
{
continue;
}
extidx = strlen(fd.cFileName) - 4;
if (extidx < 0 || stricmp(&fd.cFileName[extidx], ".vdf"))
{
continue;
}
g_Metamod.PathFormat(path, sizeof(path), "%s\\%s", dir, fd.cFileName);
ProcessVDF(path);
} while (FindNextFile(hFind, &fd));
@ -1478,6 +1470,7 @@ LookForVDFs(const char *dir)
#else
DIR *pDir;
struct dirent *pEnt;
int extidx;
if ((pDir = opendir(dir)) == NULL)
{