| 1881 | //----------------------------------------------------------------------------- |
| 1882 | |
| 1883 | bool 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 | { |
nothing calls this directly
no test coverage detected