Fix failure if MagiskManager folder doesn't exist

This commit is contained in:
topjohnwu 2017-09-13 15:46:05 +08:00
parent 01052fbe47
commit 53cf11db8c
2 changed files with 6 additions and 4 deletions

View File

@ -28,12 +28,14 @@ public class ProcessRepoZip extends ParallelTask<Void, Void, Boolean> {
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
private boolean mInstall; private boolean mInstall;
private String mLink, mFile; private String mLink;
private File mFile;
public ProcessRepoZip(Activity context, String link, String filename, boolean install) { public ProcessRepoZip(Activity context, String link, String filename, boolean install) {
super(context); super(context);
mLink = link; mLink = link;
mFile = Environment.getExternalStorageDirectory() + "/MagiskManager/" + filename; mFile = new File(Environment.getExternalStorageDirectory() + "/MagiskManager", filename);
mFile.getParentFile().mkdirs();
mInstall = install; mInstall = install;
} }
@ -108,7 +110,7 @@ public class ProcessRepoZip extends ParallelTask<Void, Void, Boolean> {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity == null) return; if (activity == null) return;
progressDialog.dismiss(); progressDialog.dismiss();
Uri uri = Uri.fromFile(new File(mFile)); Uri uri = Uri.fromFile(mFile);
if (result) { if (result) {
if (Shell.rootAccess() && mInstall) { if (Shell.rootAccess() && mInstall) {
Intent intent = new Intent(getActivity(), FlashActivity.class); Intent intent = new Intent(getActivity(), FlashActivity.class);

View File

@ -7,7 +7,7 @@ buildscript {
maven { url "https://maven.google.com" } maven { url "https://maven.google.com" }
} }
dependencies { 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 // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files