| 198 | //----------------------------------------------------------------------------- |
| 199 | |
| 200 | bool ModuleManager::scanModules( const char* pPath, const bool rootOnly ) |
| 201 | { |
| 202 | // Lock database. |
| 203 | LockDatabase( this ); |
| 204 | |
| 205 | // Sanity! |
| 206 | AssertFatal( pPath != NULL, "Cannot scan module with NULL path." ); |
| 207 | |
| 208 | String relBasePath = Platform::makeRelativePathName(pPath, NULL); |
| 209 | // Info. |
| 210 | if ( mEchoInfo ) |
| 211 | { |
| 212 | Con::printSeparator(); |
| 213 | Con::printf("Module Manager: Started scanning '%s'...", relBasePath.c_str()); |
| 214 | } |
| 215 | |
| 216 | String pattern = "*."; |
| 217 | pattern += mModuleExtension; |
| 218 | |
| 219 | Torque::Path scanPath = Torque::FS::GetCwd(); |
| 220 | scanPath.setPath(relBasePath); |
| 221 | |
| 222 | Vector<String> fileList; |
| 223 | S32 numModules = Torque::FS::FindByPattern(scanPath, pattern, !rootOnly, fileList, true); |
| 224 | for (S32 i = 0; i < numModules; ++i) |
| 225 | { |
| 226 | Torque::Path modulePath = fileList[i]; |
| 227 | registerModule(modulePath.getPath(), modulePath.getFullFileName()); |
| 228 | } |
| 229 | |
| 230 | // Info. |
| 231 | if ( mEchoInfo ) |
| 232 | { |
| 233 | Con::printf("Module Manager: Finished scanning '%s'.", relBasePath.c_str()); |
| 234 | } |
| 235 | |
| 236 | return true; |
| 237 | } |
| 238 | |
| 239 | //----------------------------------------------------------------------------- |
| 240 |
no test coverage detected