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

Method synchronizeDependencies

Engine/source/module/moduleManager.cpp:1288–1456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1286//-----------------------------------------------------------------------------
1287
1288bool ModuleManager::synchronizeDependencies( ModuleDefinition* pRootModuleDefinition, const char* pTargetDependencyPath )
1289{
1290 // Sanity!
1291 AssertFatal( pRootModuleDefinition != NULL, "Cannot synchronize dependencies with NULL root module definition." );
1292 AssertFatal( pTargetDependencyPath != NULL, "Cannot synchronize dependencies with NULL target dependency path." );
1293
1294 // Fetch the root module Id.
1295 StringTableEntry rootModuleId = pRootModuleDefinition->getModuleId();
1296
1297 // Is the root module definition registered with this module manager?
1298 if ( pRootModuleDefinition->getModuleManager() != this )
1299 {
1300 // No, so warn.
1301 Con::warnf("Cannot synchronize dependencies for module Id '%s' as it is not registered with this module manager.", rootModuleId );
1302 return false;
1303 }
1304
1305 // Expand the path.
1306 char targetPathBuffer[1024];
1307 Con::expandPath( targetPathBuffer, sizeof(targetPathBuffer), pTargetDependencyPath );
1308 pTargetDependencyPath = targetPathBuffer;
1309
1310 // Is the target dependency folder a directory?
1311 if ( !Platform::isDirectory( pTargetDependencyPath ) )
1312 {
1313 // No, so we have to ensure that there is a trailing slash as that indicates a folder (not a file) when creating a path in the platform code.
1314 char createDirectoryBuffer[1024];
1315 Con::expandPath( createDirectoryBuffer, sizeof(createDirectoryBuffer), pTargetDependencyPath, NULL, true );
1316
1317 // No, so can we create it?
1318 if ( !Platform::createPath( createDirectoryBuffer ) )
1319 {
1320 // No, so warn.
1321 Con::warnf("Cannot synchronize dependencies for module Id '%s' using target directory '%s' as directory was not found and could not be created.",
1322 rootModuleId, pTargetDependencyPath );
1323 return false;
1324 }
1325 }
1326
1327 typeModuleLoadEntryVector resolvingQueue;
1328 typeModuleLoadEntryVector sourceModulesNeeded;
1329
1330 // Could we resolve source dependencies?
1331 if ( !resolveModuleDependencies( rootModuleId, pRootModuleDefinition->getVersionId(), pRootModuleDefinition->getModuleGroup(), true, resolvingQueue, sourceModulesNeeded ) )
1332 {
1333 // No, so warn.
1334 Con::warnf("Cannot synchronize dependencies for root module Id '%s' as its dependencies could not be resolved.", rootModuleId );
1335 return false;
1336 }
1337
1338 // Sanity!
1339 AssertFatal( sourceModulesNeeded.size() > 0, "Cannot synchronize dependencies as no modules were returned." );
1340
1341 // Remove the root module definition.
1342 sourceModulesNeeded.pop_back();
1343
1344 // Initialize the target module manager and scan the target folder for modules.
1345 ModuleManager targetModuleManager;

Callers 1

Calls 15

warnfFunction · 0.85
expandPathFunction · 0.85
dSprintfFunction · 0.85
getModuleIdMethod · 0.80
getModuleManagerMethod · 0.80
getVersionIdMethod · 0.80
getModuleGroupMethod · 0.80
scanModulesMethod · 0.80
getBuildIdMethod · 0.80
findModuleIdMethod · 0.80
findModuleDefinitionMethod · 0.80
getModulePathMethod · 0.80

Tested by

no test coverage detected