Example #1
0
char *Sys_FindFirst (const char *path, unsigned musthave, unsigned canthave )
{
	WIN32_FIND_DATA	findinfo;

	if (findhandle != INVALID_HANDLE_VALUE)
		Sys_Error ("Sys_FindFirst without close");

	COM_FilePath (path, findbase);
	findhandle = FindFirstFile(path, &findinfo);

	if (findhandle == INVALID_HANDLE_VALUE)
		return NULL;

	do
	{
		if (CompareAttributes(findinfo.dwFileAttributes, musthave, canthave))
		{
			Com_sprintf (findpath, sizeof(findpath), "%s/%s", findbase, findinfo.cFileName);
			return findpath;
		}
	}
	while(FindNextFile(findhandle, &findinfo));

	return NULL; 
}
Example #2
0
char *
Sys_FindFirst(char *path, unsigned musthave, unsigned canthave)
{
	struct _finddata_t findinfo;

	if (findhandle)
	{
		Sys_Error("Sys_BeginFind without close");
	}

	findhandle = 0;

	COM_FilePath(path, findbase);
	findhandle = _findfirst(path, &findinfo);

	if (findhandle == -1)
	{
		return NULL;
	}

	if (!CompareAttributes(findinfo.attrib, musthave, canthave))
	{
		return NULL;
	}

	Com_sprintf(findpath, sizeof(findpath), "%s/%s", findbase, findinfo.name);
	return findpath;
}
Example #3
0
char *Sys_FindFirst (char *path, uint32 musthave, uint32 canthave )
{
	WIN32_FIND_DATA	findinfo;

	if (findhandle != INVALID_HANDLE_VALUE)
		Sys_Error ("Sys_BeginFind without close");

	COM_FilePath (path, findbase);
	findhandle = FindFirstFile (path, &findinfo);

	if (findhandle == INVALID_HANDLE_VALUE)
		return NULL;

	if (!CompareAttributes( findinfo.dwFileAttributes, musthave, canthave ) )
		return NULL;

	Com_sprintf (findpath, sizeof(findpath), "%s/%s", findbase, findinfo.cFileName);
	return findpath;
}
Example #4
0
char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave )
{
    struct _finddata_t findinfo;

    if (findhandle)
        Sys_Error ("Sys_BeginFind without close");
    findhandle = 0;

    COM_FilePath (path, findbase);
    findhandle = _findfirst (path, &findinfo);

    // jkrige - broken file search under windows
    //          the player setup menu does not always display all the models that are installed
    //          this is being caused by free-floating files inside the baseq2\players directory
    //          this bugfix will also fix other similar faults potentially (this only affects Microsoft Windows)
#ifndef _WIN32
    if (findhandle == -1)
        return NULL;
    if ( !CompareAttributes( findinfo.attrib, musthave, canthave ) )
        return NULL;

    Com_sprintf (findpath, sizeof(findpath), "%s/%s", findbase, findinfo.name);
    return findpath;
#else
    while ((findhandle != -1))
    {
        if (CompareAttributes(findinfo.attrib, musthave, canthave))
        {
            Com_sprintf (findpath, sizeof(findpath), "%s/%s", findbase, findinfo.name);
            return findpath;
        }
        else if (_findnext(findhandle, &findinfo) == -1)
        {
            _findclose(findhandle);
            findhandle = -1;
        }
    }

    return NULL;
#endif
    // jkrige - broken file search under windows
}