Description: support ohos module import

IssueNo: I4I0BX
Feature or Bugfix: Feature
Binary Source:No

Signed-off-by: jiadexiang <jiadexiang@huawei.com>
This commit is contained in:
jiadexiang
2021-11-13 09:52:41 +08:00
parent 4d810a948a
commit a4376e2162
4 changed files with 33 additions and 5 deletions
+3 -4
View File
@@ -36,7 +36,7 @@ JSIValue ModuleManager::RequireModule(const char * const moduleName)
}
JSIValue moduleObj;
if (!strcmp(category, CATEGORY_SYSTEM)) {
if (!strcmp(category, CATEGORY_SYSTEM) || !strcmp(category, CATEGORY_OHOS)) {
uint16_t moduleCount = sizeof(OHOS_MODULES) / sizeof(Module);
moduleObj = GetModuleObject(name, OHOS_MODULES, moduleCount, requiredSystemModules);
#ifdef FEATURE_PRODUCT_MODULE
@@ -93,9 +93,8 @@ bool ModuleManager::ParseModuleName(const char * const moduleName, char** catego
return false;
}
// Get name
tokenStr = strtok_s(nullptr, ".", &next);
if (!CreateString(tokenStr, name)) {
// Get the rest as name
if (!CreateString(next, name)) {
ace_free(str);
str = nullptr;
ace_free(*category);