本文整理汇总了C++中Sys_ListFilteredFiles函数的典型用法代码示例。如果您正苦于以下问题:C++ Sys_ListFilteredFiles函数的具体用法?C++ Sys_ListFilteredFiles怎么用?C++ Sys_ListFilteredFiles使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sys_ListFilteredFiles函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Sys_ListFilteredFiles
/*
==============
Sys_ListFilteredFiles
==============
*/
void Sys_ListFilteredFiles(const char *basedir, char *subdirs, char *filter, char **list, int *numfiles)
{
char search[MAX_OSPATH], newsubdirs[MAX_OSPATH];
char filename[MAX_OSPATH];
intptr_t findhandle;
struct _finddata_t findinfo;
if (*numfiles >= MAX_FOUND_FILES - 1)
{
return;
}
if (strlen(subdirs))
{
Com_sprintf(search, sizeof(search), "%s\\%s\\*", basedir, subdirs);
}
else
{
Com_sprintf(search, sizeof(search), "%s\\*", basedir);
}
findhandle = _findfirst(search, &findinfo);
if (findhandle == -1)
{
return;
}
do
{
if (findinfo.attrib & _A_SUBDIR)
{
if (Q_stricmp(findinfo.name, ".") && Q_stricmp(findinfo.name, ".."))
{
if (strlen(subdirs))
{
Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s\\%s", subdirs, findinfo.name);
}
else
{
Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s", findinfo.name);
}
Sys_ListFilteredFiles(basedir, newsubdirs, filter, list, numfiles);
}
}
if (*numfiles >= MAX_FOUND_FILES - 1)
{
break;
}
Com_sprintf(filename, sizeof(filename), "%s\\%s", subdirs, findinfo.name);
if (!Com_FilterPath(filter, filename, qfalse))
{
continue;
}
list[*numfiles] = CopyString(filename);
(*numfiles)++;
}
while (_findnext(findhandle, &findinfo) != -1);
_findclose(findhandle);
}
示例2: Sys_ListFilteredFiles
/*
=======================================================================================================================================
Sys_ListFilteredFiles
=======================================================================================================================================
*/
void Sys_ListFilteredFiles(const char *basedir, const char *subdirs, const char *filter, char **list, int *numfiles) {
char search[MAX_OSPATH], newsubdirs[MAX_OSPATH];
char filename[MAX_OSPATH];
DIR *fdir;
struct dirent *d;
struct stat st;
if (*numfiles >= MAX_FOUND_FILES - 1) {
return;
}
if (strlen(subdirs)) {
Com_sprintf(search, sizeof(search), "%s/%s", basedir, subdirs);
} else {
Com_sprintf(search, sizeof(search), "%s", basedir);
}
if ((fdir = opendir(search)) == NULL) {
return;
}
while ((d = readdir(fdir)) != NULL) {
Com_sprintf(filename, sizeof(filename), "%s/%s", search, d->d_name);
if (stat(filename, &st) == -1) {
continue;
}
if (st.st_mode & S_IFDIR) {
if (Q_stricmp(d->d_name, ".") && Q_stricmp(d->d_name, "..")) {
if (strlen(subdirs)) {
Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s/%s", subdirs, d->d_name);
} else {
Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s", d->d_name);
}
Sys_ListFilteredFiles(basedir, newsubdirs, filter, list, numfiles);
}
}
if (*numfiles >= MAX_FOUND_FILES - 1) {
break;
}
Com_sprintf(filename, sizeof(filename), "%s/%s", subdirs, d->d_name);
if (!Com_FilterPath(filter, filename, qfalse)) {
continue;
}
list[*numfiles] = CopyString(filename);
(*numfiles)++;
}
closedir(fdir);
}
示例3: Sys_ListFilteredFiles
void Sys_ListFilteredFiles (const char *basedir, const char *subdirs, const char *filter, linkedList_t **list)
{
char search[MAX_OSPATH], newsubdirs[MAX_OSPATH];
char filename[MAX_OSPATH];
DIR *directory;
struct dirent *d;
struct stat st;
if (subdirs[0] != '\0') {
Com_sprintf(search, sizeof(search), "%s/%s", basedir, subdirs);
} else {
Com_sprintf(search, sizeof(search), "%s", basedir);
}
if ((directory = opendir(search)) == NULL)
return;
while ((d = readdir(directory)) != NULL) {
Com_sprintf(filename, sizeof(filename), "%s/%s", search, d->d_name);
if (stat(filename, &st) == -1)
continue;
if (st.st_mode & S_IFDIR) {
if (Q_strcasecmp(d->d_name, ".") && Q_strcasecmp(d->d_name, "..")) {
if (subdirs[0] != '\0') {
Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s/%s", subdirs, d->d_name);
} else {
Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s", d->d_name);
}
Sys_ListFilteredFiles(basedir, newsubdirs, filter, list);
}
}
Com_sprintf(filename, sizeof(filename), "%s/%s", subdirs, d->d_name);
if (!Com_Filter(filter, filename))
continue;
LIST_AddString(list, filename);
}
closedir(directory);
}
示例4: Sys_ListFilteredFiles
void Sys_ListFilteredFiles (const char* basedir, const char* subdirs, const char* filter, linkedList_t** list)
{
char search[MAX_OSPATH], newsubdirs[MAX_OSPATH];
char filename[MAX_OSPATH];
int findhandle;
struct _wfinddata_t findinfo;
if (subdirs[0] != '\0') {
Com_sprintf(search, sizeof(search), "%s\\%s\\*", basedir, subdirs);
} else {
Com_sprintf(search, sizeof(search), "%s\\*", basedir);
}
Sys_Utf8ToUtf16(search, wfindpath, lengthof(wfindpath));
findhandle = _wfindfirst(wfindpath, &findinfo);
if (findhandle == -1)
return;
do {
Sys_Utf16ToUtf8(findinfo.name, findname, sizeof(findname));
if (findinfo.attrib & _A_SUBDIR) {
if (Q_strcasecmp(findname, ".") && Q_strcasecmp(findname, "..")) {
if (subdirs[0] != '\0') {
Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s\\%s", subdirs, findname);
} else {
Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s", findname);
}
Sys_ListFilteredFiles(basedir, newsubdirs, filter, list);
}
}
Com_sprintf(filename, sizeof(filename), "%s\\%s", subdirs, findname);
if (!Com_Filter(filter, filename))
continue;
LIST_AddString(list, filename);
} while (_wfindnext(findhandle, &findinfo) != -1);
_findclose(findhandle);
}