MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / scanModules

Method scanModules

Engine/source/module/moduleManager.cpp:164–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162//-----------------------------------------------------------------------------
163
164bool ModuleManager::scanModules( const char* pPath, const bool rootOnly )
165{
166 // Lock database.
167 LockDatabase( this );
168
169 // Sanity!
170 AssertFatal( pPath != NULL, "Cannot scan module with NULL path." );
171
172 // Expand module location.
173 char pathBuffer[1024];
174 Con::expandPath( pathBuffer, sizeof(pathBuffer), pPath );
175
176 // Info.
177 if ( mEchoInfo )
178 {
179 Con::printSeparator();
180 Con::printf( "Module Manager: Started scanning '%s'...", pathBuffer );
181 }
182
183 Vector<StringTableEntry> directories;
184
185 // Find directories.
186 if ( !Platform::dumpDirectories( pathBuffer, directories, rootOnly ? 1 : -1 ) )
187 {
188 // Failed so warn.
189 Con::warnf( "Module Manager: Failed to scan module directories in path '%s'.", pathBuffer );
190 return false;
191 }
192
193 // Fetch extension length.
194 const U32 extensionLength = dStrlen( mModuleExtension );
195
196 Vector<Platform::FileInfo> files;
197
198 // Iterate directories.
199 for( Vector<StringTableEntry>::iterator basePathItr = directories.begin(); basePathItr != directories.end(); ++basePathItr )
200 {
201 // Fetch base path.
202 StringTableEntry basePath = *basePathItr;
203
204 // Skip if we're only processing the root and this is not the root.
205 if ( rootOnly && basePathItr != directories.begin() )
206 continue;
207
208 // Find files.
209 files.clear();
210 if ( !Platform::dumpPath( basePath, files, 0 ) )
211 {
212 // Failed so warn.
213 Con::warnf( "Module Manager: Failed to scan modules files in directory '%s'.", basePath );
214 return false;
215 }
216
217 // Iterate files.
218 for ( Vector<Platform::FileInfo>::iterator fileItr = files.begin(); fileItr != files.end(); ++fileItr )
219 {
220 // Fetch file info.
221 Platform::FileInfo* pFileInfo = fileItr;

Callers 6

main.csFile · 0.80
main.csFile · 0.80
canMergeModulesMethod · 0.80
mergeModulesMethod · 0.80

Calls 10

LockDatabaseClass · 0.85
expandPathFunction · 0.85
printSeparatorFunction · 0.85
printfFunction · 0.85
warnfFunction · 0.85
dStricmpFunction · 0.85
dStrlenFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected