diff options
Diffstat (limited to 'src/pw/cloudef')
-rw-r--r-- | src/pw/cloudef/rpg/Launcher.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pw/cloudef/rpg/Launcher.java b/src/pw/cloudef/rpg/Launcher.java index 626ac14..ab2e9b2 100644 --- a/src/pw/cloudef/rpg/Launcher.java +++ b/src/pw/cloudef/rpg/Launcher.java @@ -74,6 +74,14 @@ public class Launcher extends Activity { return null; } + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + try { Os.remove(zipPath()); } catch (Exception e) {} + try { Os.remove(baseDir() + "/game.zip"); } catch (Exception e) {} + try { Os.remove(baseDir() + "/rtp"); } catch (Exception e) {} + finishAndRemoveTask(); + } + protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { @@ -82,6 +90,7 @@ public class Launcher extends Activity { OutputStream output = new FileOutputStream(file); byte[] buf = new byte[8 * 1024]; for (int read = 0; (read = input.read(buf)) != -1;) output.write(buf, 0, read); + output.close(); input.close(); Class activity = getActivityForZip(file); if (activity == null) throw new Exception("Can't handle this game"); new File(baseDir()).mkdirs(); @@ -92,13 +101,14 @@ public class Launcher extends Activity { Os.symlink(rtpDir(), baseDir() + "/rtp"); Intent intent = new Intent(this, activity); intent.putExtra("id", gameId()); - startActivity(intent); + startActivityForResult(intent, 1); finish(); } catch (Exception e) { Log.d("pw.cloudef.rpg", e.toString()); try { Os.remove(zipPath()); } catch (Exception e2) {} try { Os.remove(baseDir() + "/game.zip"); } catch (Exception e2) {} + try { Os.remove(baseDir() + "/rtp"); } catch (Exception e2) {} + finishAndRemoveTask(); } - finishAndRemoveTask(); } } |