From 910aab8527c05ea71b0691f79a0ec1f0f305c303 Mon Sep 17 00:00:00 2001 From: artdeell Date: Sun, 29 Nov 2020 18:38:50 +0300 Subject: [PATCH] SANITY: remove the existing runtime before installing --- .../net/kdt/pojavlaunch/PojavLoginActivity.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java b/app/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java index 9ed4790c8..081b0c89e 100644 --- a/app/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java +++ b/app/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java @@ -407,7 +407,20 @@ public class PojavLoginActivity extends BaseActivity private boolean installRuntimeAutomatically(AssetManager am) { File rtUniversal = new File(Tools.homeJreDir+"/universal.tar.xz"); File rtPlatformDependent = new File(Tools.homeJreDir+"/cust-bin.tar.xz"); - if(!new File(Tools.homeJreDir).exists()) new File(Tools.homeJreDir).mkdirs(); + if(!new File(Tools.homeJreDir).exists()) new File(Tools.homeJreDir).mkdirs(); else { + //SANITY: remove the existing files + for (File f : new File(Tools.homeJreDir).listFiles()) { + if (f.isDirectory()){ + try { + FileUtils.deleteDirectory(f); + } catch(IOException e1) { + Log.e("JREAuto","da fuq is wrong wit ur device? n2",e1); + } + } else{ + f.delete(); + } + } + } InputStream is; FileOutputStream os; try {