2 #include "../game_extv.h"
4 void find_files_by_pattern(const char* pattern
, svector
<char *>& filenames
)
7 WIN32_FIND_DATA finddata
;
10 h
=FindFirstFile(pattern
,&finddata
);
12 if(h
!=INVALID_HANDLE_VALUE
)
14 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,".."))
16 if(!(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
))
18 c
=new char[strlen(finddata
.cFileName
)+1];
19 strcpy(c
,finddata
.cFileName
);
20 filenames
.push_back(c
);
24 while(FindNextFile(h
,&finddata
))
26 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,".."))
28 if(!(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
))
30 c
=new char[strlen(finddata
.cFileName
)+1];
31 strcpy(c
,finddata
.cFileName
);
32 filenames
.push_back(c
);
41 void find_files_by_pattern_with_exception(const char* pattern
, svector
<char *>& filenames
,const char *exception
)
44 WIN32_FIND_DATA finddata
;
47 h
=FindFirstFile(pattern
,&finddata
);
49 if(h
!=INVALID_HANDLE_VALUE
)
51 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,"..")&&strcmp(finddata
.cFileName
,exception
))
53 if(!(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
))
55 c
=new char[strlen(finddata
.cFileName
)+1];
56 strcpy(c
,finddata
.cFileName
);
57 filenames
.push_back(c
);
61 while(FindNextFile(h
,&finddata
))
63 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,"..")&&strcmp(finddata
.cFileName
,exception
))
65 if(!(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
))
67 c
=new char[strlen(finddata
.cFileName
)+1];
68 strcpy(c
,finddata
.cFileName
);
69 filenames
.push_back(c
);
78 void find_files_by_pattern(const char* pattern
, stringvectst
&filenames
)
81 WIN32_FIND_DATA finddata
;
83 h
=FindFirstFile(pattern
,&finddata
);
85 if(h
!=INVALID_HANDLE_VALUE
)
87 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,".."))
89 if(!(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
))filenames
.add_string(finddata
.cFileName
);
92 while(FindNextFile(h
,&finddata
))
94 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,".."))
96 if(!(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
))filenames
.add_string(finddata
.cFileName
);
104 void find_files_by_pattern_with_exception(const char* pattern
, stringvectst
&filenames
,const char *exception
)
107 WIN32_FIND_DATA finddata
;
109 h
=FindFirstFile(pattern
,&finddata
);
111 if(h
!=INVALID_HANDLE_VALUE
)
113 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,"..")&&strcmp(finddata
.cFileName
,exception
))
115 if(!(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
))filenames
.add_string(finddata
.cFileName
);
118 while(FindNextFile(h
,&finddata
))
120 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,"..")&&strcmp(finddata
.cFileName
,exception
))
122 if(!(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
))filenames
.add_string(finddata
.cFileName
);
130 void find_directories_by_pattern(const char* pattern
, stringvectst
&filenames
)
133 WIN32_FIND_DATA finddata
;
135 h
=FindFirstFile(pattern
,&finddata
);
137 if(h
!=INVALID_HANDLE_VALUE
)
139 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,".."))
141 if(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)filenames
.add_string(finddata
.cFileName
);
144 while(FindNextFile(h
,&finddata
))
146 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,".."))
148 if(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)filenames
.add_string(finddata
.cFileName
);
156 void find_directories_by_pattern_with_exception(const char* pattern
, stringvectst
&filenames
,const char *exception
)
159 WIN32_FIND_DATA finddata
;
161 h
=FindFirstFile(pattern
,&finddata
);
163 if(h
!=INVALID_HANDLE_VALUE
)
165 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,"..")&&strcmp(finddata
.cFileName
,exception
))
167 if(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)filenames
.add_string(finddata
.cFileName
);
170 while(FindNextFile(h
,&finddata
))
172 if(strcmp(finddata
.cFileName
,".")&&strcmp(finddata
.cFileName
,"..")&&strcmp(finddata
.cFileName
,exception
))
174 if(finddata
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)filenames
.add_string(finddata
.cFileName
);