From 7684602ea82b9f4a64f680660ad58f4c37d9b897 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 26 Jun 2018 06:04:11 +0800 Subject: [PATCH] More fixes for non-root devices --- build.gradle | 2 +- src/full/java/com/topjohnwu/magisk/utils/ZipUtils.java | 2 +- src/main/java/com/topjohnwu/magisk/utils/Const.java | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index fdb4591f4..18f887f12 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ android { productFlavors { full { - versionCode 120 + versionCode 121 versionName "5.7.0" } stub { diff --git a/src/full/java/com/topjohnwu/magisk/utils/ZipUtils.java b/src/full/java/com/topjohnwu/magisk/utils/ZipUtils.java index d838020a7..f18eb7017 100644 --- a/src/full/java/com/topjohnwu/magisk/utils/ZipUtils.java +++ b/src/full/java/com/topjohnwu/magisk/utils/ZipUtils.java @@ -41,7 +41,7 @@ public class ZipUtils { name = entry.getName(); } File dest = new File(folder, name); - if (!dest.getParentFile().mkdirs()) { + if (!dest.getParentFile().exists() && !dest.getParentFile().mkdirs()) { dest = new SuFile(folder, name); dest.getParentFile().mkdirs(); } diff --git a/src/main/java/com/topjohnwu/magisk/utils/Const.java b/src/main/java/com/topjohnwu/magisk/utils/Const.java index 528a6689e..9b10dff15 100644 --- a/src/main/java/com/topjohnwu/magisk/utils/Const.java +++ b/src/main/java/com/topjohnwu/magisk/utils/Const.java @@ -28,6 +28,11 @@ public class Const { public static File MAGISK_DISABLE_FILE; public static File MAGISK_HOST_FILE; + static { + /* Prevent crashing on unrooted devices */ + MAGISK_PATH = MAGISK_DISABLE_FILE = MAGISK_HOST_FILE = new File("xxx"); + } + public static final String BUSYBOX_PATH = "/sbin/.core/busybox"; public static final String TMP_FOLDER_PATH = "/dev/tmp"; public static final String MAGISK_LOG = "/cache/magisk.log";