diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Async.java b/app/src/main/java/com/topjohnwu/magisk/utils/Async.java index eed337856..41e4c10d3 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Async.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Async.java @@ -46,7 +46,7 @@ public class Async { String busybox = mContext.getApplicationInfo().dataDir + "/lib/libbusybox.so"; String zip = mContext.getApplicationInfo().dataDir + "/lib/libzip.so"; if (Shell.rootAccess()) { - if (!Utils.itemExist(toolPath)) { + if (!Utils.itemExist(false, toolPath)) { Shell.sh( "rm -rf " + toolPath, "mkdir " + toolPath, diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java index 2236f572b..4c411aedb 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java @@ -65,14 +65,16 @@ public class Utils { } public static boolean itemExist(String path) { - List ret; + return itemExist(true, path); + } + + public static boolean itemExist(boolean root, String path) { String command = "if [ -e " + path + " ]; then echo true; else echo false; fi"; - if (Shell.rootAccess()) { - ret = Shell.su(command); + if (Shell.rootAccess() && root) { + return Boolean.parseBoolean(Shell.su(command).get(0)); } else { - ret = Shell.sh(command); + return new File(path).exists(); } - return Boolean.parseBoolean(ret.get(0)); } public static boolean commandExists(String s) {