diff --git a/restool_faq.json b/restool_faq.json index bb33817..8a5633b 100644 --- a/restool_faq.json +++ b/restool_faq.json @@ -1,22 +1,32 @@ -{ - "default": { - "cn": "https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/restool", - "en": "https://developer.huawei.com/consumer/en/doc/harmonyos-guides/restool" - }, - "faqs": [ - { - "code": 11201001, - "cn": "https://developer.huawei.com/consumer/cn/doc/harmonyos-faqs/faqs-compiling-and-building-181", - "en": "https://developer.huawei.com/consumer/en/doc/harmonyos-faqs/faqs-compiling-and-building-181" - }, - { - "code": 11211120, - "extSolutions": [ - { - "fileName": "module.json", - "solution": "Check whether the hvigorfile.ts in the project root directory or the module.json5 file in the module directory references undefined resources." - } - ] - } - ] -} \ No newline at end of file +{ + "default": { + "cn": "https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/restool", + "en": "https://developer.huawei.com/consumer/en/doc/harmonyos-guides/restool" + }, + "faqs": [ + { + "code": 11201001, + "cn": "https://developer.huawei.com/consumer/cn/doc/harmonyos-faqs/faqs-compiling-and-building-181", + "en": "https://developer.huawei.com/consumer/en/doc/harmonyos-faqs/faqs-compiling-and-building-181" + }, + { + "code": 11211120, + "extSolutions": [ + { + "fileName": "module.json", + "solution": "Check whether the hvigorfile.ts in the project root directory or the module.json5 file in the module directory references undefined resources." + } + ] + }, + { + "code": 11210016, + "cn": "https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-hvigor-build-profile#section754823013348, https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/restool", + "en": "https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ide-hvigor-build-profile#section754823013348, https://developer.huawei.com/consumer/en/doc/harmonyos-guides/restool", + "extSolutions": [ + { + "solution": "Check whether the buildOption->resOptions->qualifiersConfig configuration in the module-level build-profile.json5 file is correct." + } + ] + } + ] +} diff --git a/src/restool_errors.cpp b/src/restool_errors.cpp index 15b14aa..bb2faa1 100644 --- a/src/restool_errors.cpp +++ b/src/restool_errors.cpp @@ -833,16 +833,22 @@ void PrintError(const ErrorInfo &error) return; } errMsg.append("* Try the following:").append("\n"); - for (const auto &solution : error.solutions_) { errMsg.append(" > ").append(solution).append("\n"); } auto faq = faqInfos.find(error.code_); if (faq != faqInfos.end()) { std::vector extSolutions = faq->second.extSolutions; for (const auto &solution : extSolutions) { + if (solution.fileName.empty()) { + errMsg.append(" > ").append(solution.solution).append("\n"); + continue; + } if (FileEntry(error.position_).GetFilePath().GetFilename() == solution.fileName) { errMsg.append(" > ").append(solution.solution).append("\n"); } } } + for (const auto &solution : error.solutions_) { + errMsg.append(" > ").append(solution).append("\n"); + } std::string moreInfo; if (osLanguage == Language::CN) { if (!error.moreInfo_.cn.empty()) {