From 80e55c5e78a5161bda41b730892e1a853c872ccb Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Tue, 25 Oct 2011 22:52:25 +0200 Subject: ANDROID: Point the default savepath to external storage. (If that fails, fall back to a readable app-specific directory.) --- .../android/org/scummvm/scummvm/ScummVMActivity.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'backends/platform/android/org/scummvm') diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java index a41e843323..7c61520d43 100644 --- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java +++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java @@ -14,6 +14,8 @@ import android.view.MotionEvent; import android.view.inputmethod.InputMethodManager; import android.widget.Toast; +import java.io.File; + public class ScummVMActivity extends Activity { private class MyScummVM extends ScummVM { @@ -128,6 +130,15 @@ public class ScummVMActivity extends Activity { getFilesDir().mkdirs(); + // Store savegames on external storage if we can, which means they're + // world-readable and don't get deleted on uninstall. + String savePath = Environment.getExternalStorageDirectory() + "/ScummVM/Saves/"; + File saveDir = new File(savePath); + if (!saveDir.isDirectory()) { + // If it doesn't work, resort to the internal app path. + savePath = getDir("saves", MODE_WORLD_READABLE).getPath(); + } + // Start ScummVM _scummvm = new MyScummVM(main_surface.getHolder()); @@ -136,7 +147,7 @@ public class ScummVMActivity extends Activity { "--config=" + getFileStreamPath("scummvmrc").getPath(), "--path=" + Environment.getExternalStorageDirectory().getPath(), "--gui-theme=scummmodern", - "--savepath=" + getDir("saves", 0).getPath() + "--savepath=" + savePath }); _events = new ScummVMEvents(this, _scummvm); -- cgit v1.2.3