diff --git a/app/src/main/java/top/niunaijun/blackdex/data/BlackDexConfiguration.kt b/app/src/main/java/top/niunaijun/blackdex/data/BlackDexConfiguration.kt index 62fba09..a9bd5c4 100644 --- a/app/src/main/java/top/niunaijun/blackdex/data/BlackDexConfiguration.kt +++ b/app/src/main/java/top/niunaijun/blackdex/data/BlackDexConfiguration.kt @@ -2,6 +2,9 @@ package top.niunaijun.blackdex.data import android.content.Context import top.niunaijun.blackbox.app.configuration.ClientConfiguration +import top.niunaijun.blackbox.utils.FileUtils +import top.niunaijun.blackbox.utils.compat.BuildCompat +import java.io.File /** * @@ -10,9 +13,29 @@ import top.niunaijun.blackbox.app.configuration.ClientConfiguration * @CreateDate: 2021/5/23 14:04 */ class BlackDexConfiguration(private val context: Context) : ClientConfiguration() { + + companion object { + fun getDexDumpDir(context: Context): String { + return if (BuildCompat.isR()) { + val dump = File(context.externalCacheDir?.parentFile?.parentFile?.parentFile?.parentFile, "Download/dexDump") + FileUtils.mkdirs(dump) + dump.absolutePath + } else { + val dump = File(context.externalCacheDir?.parentFile, "dump") + FileUtils.mkdirs(dump) + dump.absolutePath + } + } + } + + private val dir = getDexDumpDir(context) + override fun getHostPackageName(): String { return context.packageName } + override fun getDexDumpDir(): String { + return dir + } } \ No newline at end of file diff --git a/app/src/main/java/top/niunaijun/blackdex/util/FileUtil.kt b/app/src/main/java/top/niunaijun/blackdex/util/FileUtil.kt deleted file mode 100644 index c78a117..0000000 --- a/app/src/main/java/top/niunaijun/blackdex/util/FileUtil.kt +++ /dev/null @@ -1,27 +0,0 @@ -package top.niunaijun.blackdex.util - -import top.niunaijun.blackbox.BlackBoxCore -import top.niunaijun.blackbox.utils.FileUtils -import top.niunaijun.blackbox.utils.compat.BuildCompat -import java.io.File - -/** - * - * @Description: - * @Author: wukaicheng - * @CreateDate: 2021/5/23 14:54 - */ -object FileUtil { - - fun getDexDumpDir(): String { - if (BuildCompat.isR()) { - val dump = File(BlackBoxCore.getContext().externalCacheDir?.parentFile?.parentFile?.parentFile, "Download/dexDump") - FileUtils.mkdirs(dump) - return dump.absolutePath - }else{ - val dump = File(BlackBoxCore.getContext().externalCacheDir?.parentFile, "dump") - FileUtils.mkdirs(dump) - return dump.absolutePath - } - } -} \ No newline at end of file