diff --git a/adapter/ohos/Compressor.java b/adapter/ohos/Compressor.java index 99f0dbb0a9ec5723d61e7717489c94b8b0158851..53b2d30a46c2282de68a2bf8f5389c6f56650ee6 100644 --- a/adapter/ohos/Compressor.java +++ b/adapter/ohos/Compressor.java @@ -3342,6 +3342,13 @@ public class Compressor { hapVerifyInfo.setStageModule(false); hapVerifyInfo.setFileLength(FileUtils.getFileSize(filePath)); ModuleJsonUtil.parseFAHapVerifyInfo(hapVerifyInfo); + File srcFile = new File(filePath); + String fileStr = srcFile.getName(); + if(fileStr.toLowerCase(Locale.ENGLISH).endsWith(HAP_SUFFIX)){ + hapVerifyInfo.setFileType(HAP_SUFFIX); + }else if (fileStr.toLowerCase(Locale.ENGLISH).endsWith(HSP_SUFFIX)){ + hapVerifyInfo.setFileType(HSP_SUFFIX); + } return hapVerifyInfo; } diff --git a/packing_tool/frameworks/src/json/module_json_utils.cpp b/packing_tool/frameworks/src/json/module_json_utils.cpp index 7fbdb2bcb88ce5ccc48948be11aec52143b1bcb4..c0cfea32b5fe1408e415f41a2f4add61bb96c56e 100644 --- a/packing_tool/frameworks/src/json/module_json_utils.cpp +++ b/packing_tool/frameworks/src/json/module_json_utils.cpp @@ -112,6 +112,18 @@ bool ModuleJsonUtils::GetFaHapVerifyInfo(const std::string& hapFilePath, HapVeri hapVerifyInfo.SetProfileStr(fileContent); hapVerifyInfo.SetStageModule(false); hapVerifyInfo.SetFileLength(fileLength); + + std::string fileType = ""; + fs::path fsHapPath(hapFilePath); + std::string fileName = fsHapPath.filename().string(); + std::transform(fileName.begin(), fileName.end(), fileName.begin(), ::tolower); + if (Utils::EndsWith(fileName, HAP_SUFFIX)) { + fileType = HAP_SUFFIX; + } else if (Utils::EndsWith(fileName, HSP_SUFFIX)) { + fileType = HSP_SUFFIX; + } + hapVerifyInfo.SetFileType(fileType); + return true; } diff --git a/packing_tool/frameworks/src/log.cpp b/packing_tool/frameworks/src/log.cpp index 61d7be6d938cb854c172a71bdf1e7f6f16893b37..d229135778123349e12127adf9c747495ae87047 100644 --- a/packing_tool/frameworks/src/log.cpp +++ b/packing_tool/frameworks/src/log.cpp @@ -34,7 +34,7 @@ const int MS_LEN = 3; void Log(char *file, char *func, int32_t line, int32_t level, char *format, ...) { - if (level < DEFAULT_LOG_LEVEL) { + if (level < DEFAULT_LOG_LEVEL || level > LOG_LEVEL::LOG_LEVEL_FATAL) { return; } auto now = std::chrono::system_clock::now();