-----------------------------------------------------------------------
| 192 | #endif |
| 193 | //----------------------------------------------------------------------- |
| 194 | void FileSystemArchive::findFiles(const String& pattern, bool recursive, |
| 195 | bool dirs, StringVector* simpleList, FileInfoList* detailList) const |
| 196 | { |
| 197 | intptr_t lHandle, res; |
| 198 | #ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE |
| 199 | struct _wfinddata_t tagData; |
| 200 | #else |
| 201 | struct _finddata_t tagData; |
| 202 | #endif |
| 203 | |
| 204 | // pattern can contain a directory name, separate it from mask |
| 205 | size_t pos1 = pattern.rfind ('/'); |
| 206 | size_t pos2 = pattern.rfind ('\\'); |
| 207 | if (pos1 == pattern.npos || ((pos2 != pattern.npos) && (pos1 < pos2))) |
| 208 | pos1 = pos2; |
| 209 | String directory; |
| 210 | if (pos1 != pattern.npos) |
| 211 | directory = pattern.substr (0, pos1 + 1); |
| 212 | |
| 213 | String full_pattern = concatenate_path(mName, pattern); |
| 214 | |
| 215 | #ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE |
| 216 | lHandle = _wfindfirst(to_wpath(full_pattern).c_str(), &tagData); |
| 217 | #else |
| 218 | lHandle = _findfirst(full_pattern.c_str(), &tagData); |
| 219 | #endif |
| 220 | res = 0; |
| 221 | while (lHandle != -1 && res != -1) |
| 222 | { |
| 223 | if ((dirs == ((tagData.attrib & _A_SUBDIR) != 0)) && |
| 224 | ( !gIgnoreHidden || (tagData.attrib & _A_HIDDEN) == 0 ) && |
| 225 | (!dirs || !is_reserved_dir (tagData.name))) |
| 226 | { |
| 227 | if (simpleList) |
| 228 | { |
| 229 | #ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE |
| 230 | simpleList->push_back(directory + from_wpath(tagData.name)); |
| 231 | #else |
| 232 | simpleList->push_back(directory + tagData.name); |
| 233 | #endif |
| 234 | } |
| 235 | else if (detailList) |
| 236 | { |
| 237 | FileInfo fi; |
| 238 | fi.archive = this; |
| 239 | #ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE |
| 240 | fi.filename = directory + from_wpath(tagData.name); |
| 241 | fi.basename = from_wpath(tagData.name); |
| 242 | #else |
| 243 | fi.filename = directory + tagData.name; |
| 244 | fi.basename = tagData.name; |
| 245 | #endif |
| 246 | fi.path = directory; |
| 247 | fi.compressedSize = tagData.size; |
| 248 | fi.uncompressedSize = tagData.size; |
| 249 | detailList->push_back(fi); |
| 250 | } |
| 251 | } |
nothing calls this directly
no test coverage detected