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

Method canMergeModules

Engine/source/module/moduleManager.cpp:1460–1514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1458//-----------------------------------------------------------------------------
1459
1460bool ModuleManager::canMergeModules( const char* pMergeSourcePath )
1461{
1462 // Sanity!
1463 AssertFatal( pMergeSourcePath != NULL, "Cannot check merge modules with NULL source path." );
1464
1465 // Expand the source path.
1466 char sourcePathBuffer[1024];
1467 Con::expandPath( sourcePathBuffer, sizeof(sourcePathBuffer), pMergeSourcePath );
1468 pMergeSourcePath = sourcePathBuffer;
1469
1470 // Is the path a valid directory?
1471 if ( !Platform::isDirectory( sourcePathBuffer ) )
1472 {
1473 // No, so warn.
1474 Con::warnf( "Cannot check merge modules as path is invalid '%s'.", sourcePathBuffer );
1475 return false;
1476 }
1477
1478 // Initialize the source module manager and scan the source folder for modules.
1479 ModuleManager mergeModuleManager;
1480 mergeModuleManager.mEnforceDependencies = false;
1481 mergeModuleManager.mEchoInfo = false;
1482 mergeModuleManager.scanModules( pMergeSourcePath );
1483
1484 // Find all the merge modules.
1485 typeConstModuleDefinitionVector mergeModules;
1486 mergeModuleManager.findModules( false, mergeModules );
1487
1488 // Iterate found merge module definitions.
1489 for ( typeConstModuleDefinitionVector::const_iterator mergeModuleItr = mergeModules.begin(); mergeModuleItr != mergeModules.end(); ++mergeModuleItr )
1490 {
1491 // Fetch module definition.
1492 const ModuleDefinition* pMergeModuleDefinition = *mergeModuleItr;
1493
1494 // Fetch module Id.
1495 StringTableEntry moduleId = pMergeModuleDefinition->getModuleId();
1496
1497 // Fetch version Id.
1498 const U32 versionId = pMergeModuleDefinition->getVersionId();
1499
1500 // Fetch module group.
1501 StringTableEntry moduleGroup = pMergeModuleDefinition->getModuleGroup();
1502
1503 // Cannot merge if module already exists.
1504 if ( findModuleDefinition( moduleId, versionId ) != NULL )
1505 return false;
1506
1507 // Cannot merge if module is part of a loaded group.
1508 if ( findGroupLoaded( moduleGroup ) != NULL )
1509 return false;
1510 }
1511
1512 // Can merge modules.
1513 return true;
1514}
1515
1516//-----------------------------------------------------------------------------
1517

Callers 1

Calls 9

expandPathFunction · 0.85
warnfFunction · 0.85
scanModulesMethod · 0.80
findModulesMethod · 0.80
getModuleIdMethod · 0.80
getVersionIdMethod · 0.80
getModuleGroupMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected