From 31ce4b2acd3ee66f58e6dbbbd82a8bd2c134519f Mon Sep 17 00:00:00 2001 From: luoyesiqiu Date: Tue, 14 May 2019 23:11:59 +0800 Subject: [PATCH] Optimize the replication logic of so and modules --- .../com/storm/wind/xpatch/task/SoAndDexCopyTask.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/xpatch/src/main/java/com/storm/wind/xpatch/task/SoAndDexCopyTask.java b/xpatch/src/main/java/com/storm/wind/xpatch/task/SoAndDexCopyTask.java index 71e1eaf..dec6e97 100644 --- a/xpatch/src/main/java/com/storm/wind/xpatch/task/SoAndDexCopyTask.java +++ b/xpatch/src/main/java/com/storm/wind/xpatch/task/SoAndDexCopyTask.java @@ -51,7 +51,9 @@ public class SoAndDexCopyTask implements Runnable { private void copySoFile() { for (String libPath : APK_LIB_PATH_ARRAY) { String apkSoFullPath = fullLibPath(libPath); - copyLibFile(apkSoFullPath, SO_FILE_PATH_MAP.get(libPath)); + if(new File(apkSoFullPath).exists()) { + copyLibFile(apkSoFullPath, SO_FILE_PATH_MAP.get(libPath)); + } } // copy xposed modules into the lib path if (xposedModuleArray != null && xposedModuleArray.length > 0) { @@ -67,9 +69,12 @@ public class SoAndDexCopyTask implements Runnable { } for (String libPath : APK_LIB_PATH_ARRAY) { String apkSoFullPath = fullLibPath(libPath); - String outputModuleFile = XPOSED_MODULE_FILE_NAME_PREFIX + index + SO_FILE_SUFFIX; + String outputModuleName= XPOSED_MODULE_FILE_NAME_PREFIX + index + SO_FILE_SUFFIX; + if(new File(apkSoFullPath).exists()) { + File outputModuleSoFile = new File(apkSoFullPath, outputModuleName); + FileUtils.copyFile(moduleFile, outputModuleSoFile); + } - FileUtils.copyFile(moduleFile, new File(apkSoFullPath, outputModuleFile)); } index++; }