mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-19 11:31:44 -04:00
@@ -74,7 +74,7 @@ uint32_t ConfigParser::Init()
|
||||
}
|
||||
|
||||
if (!root_ || !cJSON_IsObject(root_)) {
|
||||
cerr << "Error: ConfigParser root node not obeject." << NEW_LINE_PATH << filePath_ << endl;
|
||||
cerr << "Error: JSON file parsing failed, please check the JSON file." << NEW_LINE_PATH << filePath_ << endl;
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,17 +85,20 @@ uint32_t IdDefinedParser::Init(const string &filePath, bool isSystem)
|
||||
}
|
||||
|
||||
if (!root_ || !cJSON_IsObject(root_)) {
|
||||
cerr << "Error: IdDefinedParser root node not obeject." << NEW_LINE_PATH << filePath << endl;
|
||||
cerr << "Error: JSON file parsing failed, please check the JSON file.";
|
||||
cerr << NEW_LINE_PATH << filePath << endl;
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
|
||||
cJSON *recordNode = cJSON_GetObjectItem(root_, "record");
|
||||
if (!recordNode || !cJSON_IsArray(recordNode)) {
|
||||
cerr << "Error: id_defined.json record not array." << endl;
|
||||
cerr << "Error: 'record' node is not an array, please check the JSON file.";
|
||||
cerr << NEW_LINE_PATH << filePath << endl;
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
if (cJSON_GetArraySize(recordNode) == 0) {
|
||||
cerr << "Error: id_defined.json 'record' empty." << endl;
|
||||
cerr << "Error: 'record' node is empty, please check the JSON file.";
|
||||
cerr << NEW_LINE_PATH << filePath << endl;
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
int32_t startSysId = 0;
|
||||
|
||||
@@ -54,19 +54,22 @@ uint32_t JsonCompiler::CompileSingleFile(const FileInfo &fileInfo)
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
if (!root_ || !cJSON_IsObject(root_)) {
|
||||
cerr << "Error: JsonCompiler root node not obeject." << NEW_LINE_PATH << fileInfo.filePath << endl;
|
||||
cerr << "Error: JSON file parsing failed, please check the JSON file.";
|
||||
cerr << NEW_LINE_PATH << fileInfo.filePath << endl;
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
cJSON *item = root_->child;
|
||||
if (cJSON_GetArraySize(root_) != 1) {
|
||||
cerr << "Error: root node must only one member." << NEW_LINE_PATH << fileInfo.filePath << endl;
|
||||
cerr << "Error: node of a JSON file can only have one member, please check the JSON file.";
|
||||
cerr << NEW_LINE_PATH << fileInfo.filePath << endl;
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
|
||||
string tag = item->string;
|
||||
auto ret = g_contentClusterMap.find(tag);
|
||||
if (ret == g_contentClusterMap.end()) {
|
||||
cerr << "Error: invalid tag name '" << tag << "'." << NEW_LINE_PATH << fileInfo.filePath << endl;
|
||||
cerr << "Error: invalid tag name '" << tag << "', please check the JSON file.";
|
||||
cerr << NEW_LINE_PATH << fileInfo.filePath << endl;
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ bool ReferenceParser::ParseRefJson(const string &from, const string &to)
|
||||
return false;
|
||||
}
|
||||
if (!root_ || !cJSON_IsObject(root_)) {
|
||||
cerr << "Error: ReferenceParser root node not obeject." << NEW_LINE_PATH << from << endl;
|
||||
cerr << "Error: JSON file parsing failed, please check the JSON file." << NEW_LINE_PATH << from << endl;
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
bool needSave = false;
|
||||
|
||||
@@ -34,7 +34,7 @@ uint32_t ResConfigParser::Init(const string &filePath, HandleBack callback)
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
if (!root_ || !cJSON_IsObject(root_)) {
|
||||
cerr << "Error: ResConfigParser root node not obeject." << NEW_LINE_PATH << filePath << endl;
|
||||
cerr << "Error: JSON file parsing failed, please check the JSON file." << NEW_LINE_PATH << filePath << endl;
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
if (!callback) {
|
||||
|
||||
Reference in New Issue
Block a user