From ba3002608347115ea79fdc613d985df19ef25fc4 Mon Sep 17 00:00:00 2001 From: ACh Sulfate Date: Sun, 10 Sep 2023 18:08:05 +0800 Subject: [PATCH] chore: replace hardcoded path with package name --- app/src/main/java/cc/hicore/Env.java | 4 +++- .../main/java/cc/hicore/QQDecodeUtils/DecodeForEncPic.java | 5 +++-- .../java/cc/hicore/message/bridge/Chat_facade_bridge.java | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/cc/hicore/Env.java b/app/src/main/java/cc/hicore/Env.java index ee0d093fe3..f2ffdef729 100644 --- a/app/src/main/java/cc/hicore/Env.java +++ b/app/src/main/java/cc/hicore/Env.java @@ -21,6 +21,8 @@ package cc.hicore; +import cc.ioctl.util.HostInfo; + public class Env { - public static String app_save_path = "/sdcard/Android/data/com.tencent.mobileqq/files/.tool/"; + public static String app_save_path = "/sdcard/Android/data/" + HostInfo.getPackageName() + "/files/.tool/"; } diff --git a/app/src/main/java/cc/hicore/QQDecodeUtils/DecodeForEncPic.java b/app/src/main/java/cc/hicore/QQDecodeUtils/DecodeForEncPic.java index 281121ab65..0366962014 100644 --- a/app/src/main/java/cc/hicore/QQDecodeUtils/DecodeForEncPic.java +++ b/app/src/main/java/cc/hicore/QQDecodeUtils/DecodeForEncPic.java @@ -22,6 +22,7 @@ package cc.hicore.QQDecodeUtils; import android.os.Environment; +import cc.ioctl.util.HostInfo; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -40,9 +41,9 @@ private static int conVertToInt(byte[] b){ private static final byte[] GIFMask = {0,1,0,1}; public static String decodeGifForLocalPath(int dwTabID,byte[] sbufID){ try{ - String path = Environment.getExternalStorageDirectory()+"/Android/data/com.tencent.mobileqq/Tencent/MobileQQ/.emotionsm/"+dwTabID+"/" + String path = Environment.getExternalStorageDirectory()+"/Android/data/" + HostInfo.getPackageName() + "/Tencent/MobileQQ/.emotionsm/"+dwTabID+"/" +bytesToHex(sbufID); - String cachePath = Environment.getExternalStorageDirectory()+"/Android/data/com.tencent.mobileqq/cache/" +bytesToHex(sbufID); + String cachePath = Environment.getExternalStorageDirectory()+"/Android/data/" + HostInfo.getPackageName() + "/cache/" +bytesToHex(sbufID); decodeGif(path,cachePath); return cachePath; }catch (Exception e){ diff --git a/app/src/main/java/cc/hicore/message/bridge/Chat_facade_bridge.java b/app/src/main/java/cc/hicore/message/bridge/Chat_facade_bridge.java index bb0d7da8a9..382bdf0d35 100644 --- a/app/src/main/java/cc/hicore/message/bridge/Chat_facade_bridge.java +++ b/app/src/main/java/cc/hicore/message/bridge/Chat_facade_bridge.java @@ -108,8 +108,8 @@ public static void sendArkApp(Object _Session, Object arkAppMsg) { public static void sendVoice(Object _Session, String path) { try { - if (!path.contains("com.tencent.mobileqq/Tencent/MobileQQ/" + QAppUtils.getCurrentUin())) { - String newPath = Environment.getExternalStorageDirectory() + "/Android/data/com.tencent.mobileqq/Tencent/MobileQQ/" + QAppUtils.getCurrentUin() + if (!path.contains(HostInfo.getPackageName() + "/Tencent/MobileQQ/" + QAppUtils.getCurrentUin())) { + String newPath = Environment.getExternalStorageDirectory() + "/Android/data/" + HostInfo.getPackageName() + "/Tencent/MobileQQ/" + QAppUtils.getCurrentUin() + "/ptt/" + new File(path).getName(); FileUtils.copy(path, newPath); path = newPath;