From 53cf11db8cbe63ff7365056f7a9f6e5e14cae46d Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 13 Sep 2017 15:46:05 +0800 Subject: [PATCH] Fix failure if MagiskManager folder doesn't exist --- .../java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java | 8 +++++--- build.gradle | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java b/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java index 2e86a8831..477f6b6d7 100644 --- a/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java +++ b/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java @@ -28,12 +28,14 @@ public class ProcessRepoZip extends ParallelTask { private ProgressDialog progressDialog; private boolean mInstall; - private String mLink, mFile; + private String mLink; + private File mFile; public ProcessRepoZip(Activity context, String link, String filename, boolean install) { super(context); mLink = link; - mFile = Environment.getExternalStorageDirectory() + "/MagiskManager/" + filename; + mFile = new File(Environment.getExternalStorageDirectory() + "/MagiskManager", filename); + mFile.getParentFile().mkdirs(); mInstall = install; } @@ -108,7 +110,7 @@ public class ProcessRepoZip extends ParallelTask { Activity activity = getActivity(); if (activity == null) return; progressDialog.dismiss(); - Uri uri = Uri.fromFile(new File(mFile)); + Uri uri = Uri.fromFile(mFile); if (result) { if (Shell.rootAccess() && mInstall) { Intent intent = new Intent(getActivity(), FlashActivity.class); diff --git a/build.gradle b/build.gradle index aa96c61c1..405d492cd 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url "https://maven.google.com" } } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0-beta4' + classpath 'com.android.tools.build:gradle:3.0.0-beta5' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files