From f51e7d4bf1cb1508376e3529d5ac8281bace33fb Mon Sep 17 00:00:00 2001 From: maximum2974 Date: Thu, 7 Aug 2025 20:20:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20FA=E6=A8=A1=E5=9E=8B=E6=89=93=E5=8C=85ap?= =?UTF-8?q?p=E5=91=8A=E8=AD=A6=E6=97=A5=E5=BF=97=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: maximum2974 --- adapter/ohos/Compressor.java | 7 +++++++ .../frameworks/src/json/module_json_utils.cpp | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/adapter/ohos/Compressor.java b/adapter/ohos/Compressor.java index 99f0dbb0..53b2d30a 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 7fbdb2bc..c0cfea32 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; } -- Gitee