From d9d38e55d09aab1a4b68dea81d5760dde4307d61 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 9 Jan 2021 12:16:07 +0000 Subject: [PATCH] Immediate exit if the user hasn't copied the pak files over --- .../drbeef/doom3quest/GLES3JNIActivity.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/java/com/drbeef/doom3quest/GLES3JNIActivity.java b/java/com/drbeef/doom3quest/GLES3JNIActivity.java index 0ddc217..b1d837f 100644 --- a/java/com/drbeef/doom3quest/GLES3JNIActivity.java +++ b/java/com/drbeef/doom3quest/GLES3JNIActivity.java @@ -140,17 +140,16 @@ import static android.system.Os.setenv; checkPermissionsAndInitialize(); } - private boolean isPackageInstalled(String packageName, PackageManager packageManager) { - try { - packageManager.getPackageGids(packageName); - return true; - } catch (PackageManager.NameNotFoundException e) { - return false; - } - } - public void create() { + boolean exitAfterCopy = false; + + //If this is first run on clean system, or user hasn't copied anything yet, just exit after we have copied + if (!(new File("/sdcard/Doom3Quest/base/pak000.pk4").exists())) + { + exitAfterCopy = true; + } + copy_asset("/sdcard/Doom3Quest", "commandline.txt", false); //Create all required folders @@ -163,11 +162,17 @@ import static android.system.Os.setenv; copy_asset("/sdcard/Doom3Quest/config/base", "quest1_default.cfg", true); copy_asset("/sdcard/Doom3Quest/config/base", "quest2_default.cfg", true); + if (exitAfterCopy) + { + finish(); + System.exit(0); + } + //Read these from a file and pass through commandLineParams = new String("doom3quest"); //See if user is trying to use command line params - if(new File("/sdcard/Doom3Quest/commandline.txt").exists()) // should exist! + if(new File("/sdcard/Doom3Quest/commandline.txt").exists()) // should exist now! { BufferedReader br; try {