MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / findFiles

Method findFiles

OgreMain/src/OgreFileSystem.cpp:168–286  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

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 }

Callers

nothing calls this directly

Calls 15

concatenate_pathFunction · 0.85
to_wpathFunction · 0.85
_findfirstFunction · 0.85
is_reserved_dirFunction · 0.85
from_wpathFunction · 0.85
_findnextFunction · 0.85
_findcloseFunction · 0.85
rfindMethod · 0.80
substrMethod · 0.45
c_strMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected