-----------------------------------------------------------------------
| 166 | #endif |
| 167 | //----------------------------------------------------------------------- |
| 168 | void FileSystemArchive::findFiles( const String &pattern, bool recursive, bool dirs, |
| 169 | StringVector *simpleList, FileInfoList *detailList ) |
| 170 | { |
| 171 | intptr_t lHandle, res; |
| 172 | #ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE |
| 173 | struct _wfinddata_t tagData; |
| 174 | #else |
| 175 | struct _finddata_t tagData; |
| 176 | #endif |
| 177 | |
| 178 | // pattern can contain a directory name, separate it from mask |
| 179 | size_t pos1 = pattern.rfind( '/' ); |
| 180 | size_t pos2 = pattern.rfind( '\\' ); |
| 181 | if( pos1 == pattern.npos || ( ( pos2 != pattern.npos ) && ( pos1 < pos2 ) ) ) |
| 182 | pos1 = pos2; |
| 183 | String directory; |
| 184 | if( pos1 != pattern.npos ) |
| 185 | directory = pattern.substr( 0, pos1 + 1 ); |
| 186 | |
| 187 | String full_pattern = concatenate_path( mName, pattern ); |
| 188 | |
| 189 | #ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE |
| 190 | lHandle = _wfindfirst( to_wpath( full_pattern ).c_str(), &tagData ); |
| 191 | #else |
| 192 | lHandle = _findfirst( full_pattern.c_str(), &tagData ); |
| 193 | #endif |
| 194 | res = 0; |
| 195 | while( lHandle != -1 && res != -1 ) |
| 196 | { |
| 197 | if( ( dirs == ( ( tagData.attrib & _A_SUBDIR ) != 0 ) ) && |
| 198 | ( !msIgnoreHidden || ( tagData.attrib & _A_HIDDEN ) == 0 ) && |
| 199 | ( !dirs || !is_reserved_dir( tagData.name ) ) ) |
| 200 | { |
| 201 | if( simpleList ) |
| 202 | { |
| 203 | #ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE |
| 204 | simpleList->push_back( directory + from_wpath( tagData.name ) ); |
| 205 | #else |
| 206 | simpleList->push_back( directory + tagData.name ); |
| 207 | #endif |
| 208 | } |
| 209 | else if( detailList ) |
| 210 | { |
| 211 | FileInfo fi; |
| 212 | fi.archive = this; |
| 213 | #ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE |
| 214 | fi.filename = directory + from_wpath( tagData.name ); |
| 215 | fi.basename = from_wpath( tagData.name ); |
| 216 | #else |
| 217 | fi.filename = directory + tagData.name; |
| 218 | fi.basename = tagData.name; |
| 219 | #endif |
| 220 | fi.path = directory; |
| 221 | fi.compressedSize = tagData.size; |
| 222 | fi.uncompressedSize = tagData.size; |
| 223 | detailList->push_back( fi ); |
| 224 | } |
| 225 | } |
nothing calls this directly
no test coverage detected