mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-02-21 14:54:14 +01:00
Changed FindFirstFile code in LookForVDFs to look for *.vdf instead of *.*
This commit is contained in:
parent
08a462ac61
commit
d19cedd4eb
@ -704,17 +704,19 @@ void LoadFromVDF(const char *file)
|
|||||||
void LookForVDFs(const char *dir)
|
void LookForVDFs(const char *dir)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
int extidx;
|
|
||||||
|
|
||||||
#if defined _MSC_VER
|
#if defined _MSC_VER
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
WIN32_FIND_DATA fd;
|
WIN32_FIND_DATA fd;
|
||||||
char error[255];
|
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)
|
if ((hFind = FindFirstFile(path, &fd)) == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DWORD dw = GetLastError();
|
DWORD dw = GetLastError();
|
||||||
|
if (dw == ERROR_FILE_NOT_FOUND)
|
||||||
|
return;
|
||||||
|
|
||||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
NULL,
|
NULL,
|
||||||
dw,
|
dw,
|
||||||
@ -728,16 +730,6 @@ void LookForVDFs(const char *dir)
|
|||||||
|
|
||||||
do
|
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);
|
g_SmmAPI.PathFormat(path, sizeof(path), "%s\\%s", dir, fd.cFileName);
|
||||||
LoadFromVDF(path);
|
LoadFromVDF(path);
|
||||||
} while (FindNextFile(hFind, &fd));
|
} while (FindNextFile(hFind, &fd));
|
||||||
@ -746,6 +738,7 @@ void LookForVDFs(const char *dir)
|
|||||||
#else
|
#else
|
||||||
DIR *pDir;
|
DIR *pDir;
|
||||||
struct dirent *pEnt;
|
struct dirent *pEnt;
|
||||||
|
int extidx;
|
||||||
|
|
||||||
if ((pDir = opendir(dir)) == NULL)
|
if ((pDir = opendir(dir)) == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1436,17 +1436,19 @@ static void
|
|||||||
LookForVDFs(const char *dir)
|
LookForVDFs(const char *dir)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
int extidx;
|
|
||||||
|
|
||||||
#if defined _MSC_VER
|
#if defined _MSC_VER
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
WIN32_FIND_DATA fd;
|
WIN32_FIND_DATA fd;
|
||||||
char error[255];
|
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)
|
if ((hFind = FindFirstFile(path, &fd)) == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DWORD dw = GetLastError();
|
DWORD dw = GetLastError();
|
||||||
|
if (dw == ERROR_FILE_NOT_FOUND)
|
||||||
|
return;
|
||||||
|
|
||||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
NULL,
|
NULL,
|
||||||
dw,
|
dw,
|
||||||
@ -1460,16 +1462,6 @@ LookForVDFs(const char *dir)
|
|||||||
|
|
||||||
do
|
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);
|
g_Metamod.PathFormat(path, sizeof(path), "%s\\%s", dir, fd.cFileName);
|
||||||
ProcessVDF(path);
|
ProcessVDF(path);
|
||||||
} while (FindNextFile(hFind, &fd));
|
} while (FindNextFile(hFind, &fd));
|
||||||
@ -1478,6 +1470,7 @@ LookForVDFs(const char *dir)
|
|||||||
#else
|
#else
|
||||||
DIR *pDir;
|
DIR *pDir;
|
||||||
struct dirent *pEnt;
|
struct dirent *pEnt;
|
||||||
|
int extidx;
|
||||||
|
|
||||||
if ((pDir = opendir(dir)) == NULL)
|
if ((pDir = opendir(dir)) == NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user