Better handling for finding modules by file path. Mainly used in asset importer

This commit is contained in:
Areloch 2020-12-02 23:57:17 -06:00
parent 80eb4ab2ba
commit e8564680e4
4 changed files with 60 additions and 10 deletions

View file

@ -133,6 +133,24 @@ DefineEngineMethod(ModuleManager, findModule, String, (const char* pModuleId, U3
//-----------------------------------------------------------------------------
DefineEngineMethod(ModuleManager, findModuleByFilePath, String, (const char* filePath), (""),
"Find the specific module Id optionally at the specified version Id.\n"
"@param moduleId The module Id to find.\n"
"@param versionId The version Id to find.\n"
"@return The module definition object or NULL if not found.\n")
{
// Find module definition.
ModuleDefinition* pModuleDefinition = object->findModuleByFilePath(StringTable->insert(filePath));
// Return nothing if not found.
if (pModuleDefinition == NULL)
return StringTable->EmptyString();
return pModuleDefinition->getIdString();
}
//-----------------------------------------------------------------------------
DefineEngineMethod(ModuleManager, findModules, String, (bool loadedOnly), (false),
"Find all the modules registered with the specified loaded state.\n"
"@param loadedOnly Whether to return only modules that are loaded or not.\n"