Immediate exit if the user hasn't copied the pak files over

This commit is contained in:
Simon 2021-01-09 12:16:07 +00:00
parent 1524207644
commit d9d38e55d0

View file

@ -140,17 +140,16 @@ import static android.system.Os.setenv;
checkPermissionsAndInitialize(); checkPermissionsAndInitialize();
} }
private boolean isPackageInstalled(String packageName, PackageManager packageManager) {
try {
packageManager.getPackageGids(packageName);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
public void create() { 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); copy_asset("/sdcard/Doom3Quest", "commandline.txt", false);
//Create all required folders //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", "quest1_default.cfg", true);
copy_asset("/sdcard/Doom3Quest/config/base", "quest2_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 //Read these from a file and pass through
commandLineParams = new String("doom3quest"); commandLineParams = new String("doom3quest");
//See if user is trying to use command line params //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; BufferedReader br;
try { try {