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

Method registerModule

Engine/source/module/moduleManager.cpp:1883–2133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1881//-----------------------------------------------------------------------------
1882
1883bool ModuleManager::registerModule( const char* pModulePath, const char* pModuleFile )
1884{
1885 // Sanity!
1886 AssertFatal( pModulePath != NULL, "Cannot scan module with NULL module path." );
1887 AssertFatal( pModuleFile != NULL, "Cannot scan module with NULL module file." );
1888
1889 // Make the module path a full-path.
1890 char fullPathBuffer[1024];
1891 Platform::makeFullPathName( pModulePath, fullPathBuffer, sizeof(fullPathBuffer) );
1892 pModulePath = fullPathBuffer;
1893
1894
1895 char formatBuffer[1024];
1896
1897 // Fetch module path trail character.
1898 char modulePathTrail = pModulePath[dStrlen(pModulePath) - 1];
1899
1900 // Format module file-path.
1901 dSprintf( formatBuffer, sizeof(formatBuffer), modulePathTrail == '/' ? "%s%s" : "%s/%s", pModulePath, pModuleFile );
1902
1903 // Read the module file.
1904 ModuleDefinition* pModuleDefinition = mTaml.read<ModuleDefinition>( formatBuffer );
1905
1906 // Did we read a module definition?
1907 if ( pModuleDefinition == NULL )
1908 {
1909 // No, so warn.
1910 Con::warnf( "Module Manager: Failed to read module definition in file '%s'.", formatBuffer );
1911 return false;
1912 }
1913
1914 // Set the module manager.
1915 pModuleDefinition->setModuleManager( this );
1916
1917 // Set module definition path.
1918 pModuleDefinition->setModulePath( pModulePath );
1919
1920 // Set module file.
1921 pModuleDefinition->setModuleFile( pModuleFile );
1922
1923 // Set module file-path.
1924 pModuleDefinition->setModuleFilePath( formatBuffer );
1925
1926 // Fetch module Id.
1927 StringTableEntry moduleId = pModuleDefinition->getModuleId();
1928
1929 // Fetch module version Id.
1930 const U32 versionId = pModuleDefinition->getVersionId();
1931
1932 // Fetch module group.
1933 StringTableEntry moduleGroup = pModuleDefinition->getModuleGroup();
1934
1935 // Fetch module type.
1936 StringTableEntry moduleType = pModuleDefinition->getModuleType();
1937
1938 // Is the module enabled?
1939 if ( !pModuleDefinition->getEnabled() )
1940 {

Callers

nothing calls this directly

Calls 15

dSprintfFunction · 0.85
warnfFunction · 0.85
dQsortFunction · 0.85
printfFunction · 0.85
executefFunction · 0.85
setModuleManagerMethod · 0.80
setModulePathMethod · 0.80
setModuleFileMethod · 0.80
setModuleFilePathMethod · 0.80
getModuleIdMethod · 0.80
getVersionIdMethod · 0.80
getModuleGroupMethod · 0.80

Tested by

no test coverage detected