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

Method canMergeModules

Engine/source/module/moduleManager.cpp:1618–1672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1616//-----------------------------------------------------------------------------
1617
1618bool ModuleManager::canMergeModules( const char* pMergeSourcePath )
1619{
1620 // Sanity!
1621 AssertFatal( pMergeSourcePath != NULL, "Cannot check merge modules with NULL source path." );
1622
1623 // Expand the source path.
1624 char sourcePathBuffer[1024];
1625 Con::expandPath( sourcePathBuffer, sizeof(sourcePathBuffer), pMergeSourcePath );
1626 pMergeSourcePath = sourcePathBuffer;
1627
1628 // Is the path a valid directory?
1629 if ( !Platform::isDirectory( sourcePathBuffer ) )
1630 {
1631 // No, so warn.
1632 Con::warnf( "Cannot check merge modules as path is invalid '%s'.", sourcePathBuffer );
1633 return false;
1634 }
1635
1636 // Initialize the source module manager and scan the source folder for modules.
1637 ModuleManager mergeModuleManager;
1638 mergeModuleManager.mEnforceDependencies = false;
1639 mergeModuleManager.mEchoInfo = false;
1640 mergeModuleManager.scanModules( pMergeSourcePath );
1641
1642 // Find all the merge modules.
1643 typeModuleDefinitionVector mergeModules;
1644 mergeModuleManager.findModules( false, mergeModules );
1645
1646 // Iterate found merge module definitions.
1647 for ( typeConstModuleDefinitionVector::const_iterator mergeModuleItr = mergeModules.begin(); mergeModuleItr != mergeModules.end(); ++mergeModuleItr )
1648 {
1649 // Fetch module definition.
1650 const ModuleDefinition* pMergeModuleDefinition = *mergeModuleItr;
1651
1652 // Fetch module Id.
1653 StringTableEntry moduleId = pMergeModuleDefinition->getModuleId();
1654
1655 // Fetch version Id.
1656 const U32 versionId = pMergeModuleDefinition->getVersionId();
1657
1658 // Fetch module group.
1659 StringTableEntry moduleGroup = pMergeModuleDefinition->getModuleGroup();
1660
1661 // Cannot merge if module already exists.
1662 if ( findModuleDefinition( moduleId, versionId ) != NULL )
1663 return false;
1664
1665 // Cannot merge if module is part of a loaded group.
1666 if ( findGroupLoaded( moduleGroup ) != NULL )
1667 return false;
1668 }
1669
1670 // Can merge modules.
1671 return true;
1672}
1673
1674//-----------------------------------------------------------------------------
1675

Callers 1

Calls 9

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

Tested by

no test coverage detected