aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/iphone/osys_iphone.cpp
diff options
context:
space:
mode:
authorOystein Eftevaag2008-02-03 12:36:51 +0000
committerOystein Eftevaag2008-02-03 12:36:51 +0000
commitdeb6baf0dbeb5e08dba6bf66d70cee07d7c22d4f (patch)
tree1690427b48159bf92fbebe392dee3c88c4f9c874 /backends/platform/iphone/osys_iphone.cpp
parentc098453ea199ff4476bd3ada90200e2b90f4de58 (diff)
downloadscummvm-rg350-deb6baf0dbeb5e08dba6bf66d70cee07d7c22d4f.tar.gz
scummvm-rg350-deb6baf0dbeb5e08dba6bf66d70cee07d7c22d4f.tar.bz2
scummvm-rg350-deb6baf0dbeb5e08dba6bf66d70cee07d7c22d4f.zip
Migration code for users updating to the 1.1.3 iPhone firmware, which has a different directory structure and permission setup
svn-id: r30761
Diffstat (limited to 'backends/platform/iphone/osys_iphone.cpp')
-rw-r--r--backends/platform/iphone/osys_iphone.cpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp
index 5bbb1b4ca9..3365c2da9d 100644
--- a/backends/platform/iphone/osys_iphone.cpp
+++ b/backends/platform/iphone/osys_iphone.cpp
@@ -27,15 +27,14 @@
#include <CoreGraphics/CGDirectDisplay.h>
#include <CoreSurface/CoreSurface.h>
-#include <AudioToolbox/AudioQueue.h>
#include <unistd.h>
#include <pthread.h>
-#include "common/system.h"
#include "common/scummsys.h"
#include "common/util.h"
#include "common/rect.h"
-#include "common/events.h"
+#include "common/file.h"
+#include "common/fs.h"
#include "base/main.h"
@@ -54,6 +53,7 @@ const OSystem::GraphicsMode OSystem_IPHONE::s_supportedGraphicsModes[] = {
AQCallbackStruct OSystem_IPHONE::s_AudioQueue;
SoundProc OSystem_IPHONE::s_soundCallback = NULL;
void *OSystem_IPHONE::s_soundParam = NULL;
+bool OSystem_IPHONE::s_is113OrHigher = false;
OSystem_IPHONE::OSystem_IPHONE() :
_savefile(NULL), _mixer(NULL), _timer(NULL), _offscreen(NULL),
@@ -1172,8 +1172,47 @@ OSystem *OSystem_IPHONE_create() {
return new OSystem_IPHONE();
}
+const char* OSystem_IPHONE::getConfigPath() {
+ if (s_is113OrHigher)
+ return SCUMMVM_PREFS_PATH;
+ else
+ return SCUMMVM_OLD_PREFS_PATH;
+}
+
+const char* OSystem_IPHONE::getSavePath() {
+ if (s_is113OrHigher)
+ return SCUMMVM_SAVE_PATH;
+ else
+ return SCUMMVM_OLD_SAVE_PATH;
+}
+
+void OSystem_IPHONE::migrateApp() {
+ // Migrate to the new 1.1.3 directory structure, if needed.
+
+ FilesystemNode file("/var/mobile");
+ if (file.exists() && file.isDirectory()) {
+ // We have 1.1.3 or above.
+ s_is113OrHigher = true;
+ file = FilesystemNode(SCUMMVM_ROOT_PATH);
+ if (!file.exists()) {
+ system("mkdir " SCUMMVM_ROOT_PATH);
+ system("mkdir " SCUMMVM_SAVE_PATH);
+
+ // Copy over the prefs file
+ system("cp " SCUMMVM_OLD_PREFS_PATH " " SCUMMVM_PREFS_PATH);
+
+ file = FilesystemNode(SCUMMVM_OLD_SAVE_PATH);
+ // Copy over old savegames to the new directory.
+ if (file.exists() && file.isDirectory())
+ system("cp " SCUMMVM_OLD_SAVE_PATH "/* " SCUMMVM_SAVE_PATH "/");
+ }
+ }
+}
+
void iphone_main(int argc, char *argv[]) {
+ OSystem_IPHONE::migrateApp();
+
// Redirect stdout and stderr if we're launching from the Springboard.
if (argc == 2 && strcmp(argv[1], "--launchedFromSB") == 0) {
FILE *newfp = fopen("/tmp/scummvm.log", "a");