aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/gp2x/gp2x.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/gp2x/gp2x.cpp')
-rw-r--r--backends/platform/gp2x/gp2x.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
index 5aac6be768..039f72e02f 100644
--- a/backends/platform/gp2x/gp2x.cpp
+++ b/backends/platform/gp2x/gp2x.cpp
@@ -37,6 +37,7 @@
#include "common/events.h"
#include "common/util.h"
+#include "common/debug.h"
#include "common/file.h"
#include "base/main.h"
@@ -376,6 +377,22 @@ void OSystem_GP2X::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
}
#endif
+#if defined(MACOSX) || defined(IPHONE)
+ // Get URL of the Resource directory of the .app bundle
+ CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
+ if (fileUrl) {
+ // Try to convert the URL to an absolute path
+ UInt8 buf[MAXPATHLEN];
+ if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {
+ // Success: Add it to the search path
+ Common::String bundlePath((const char *)buf);
+ s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath), priority);
+ }
+ CFRelease(fileUrl);
+ }
+
+#endif
+
}
static Common::String getDefaultConfigFileName() {
@@ -384,14 +401,14 @@ static Common::String getDefaultConfigFileName() {
return configFile;
}
-Common::SeekableReadStream *OSystem_GP2X::openConfigFileForReading() {
+Common::SeekableReadStream *OSystem_GP2X::createConfigReadStream() {
Common::FSNode file(getDefaultConfigFileName());
- return file.openForReading();
+ return file.createReadStream();
}
-Common::WriteStream *OSystem_GP2X::openConfigFileForWriting() {
+Common::WriteStream *OSystem_GP2X::createConfigWriteStream() {
Common::FSNode file(getDefaultConfigFileName());
- return file.openForWriting();
+ return file.createWriteStream();
}
bool OSystem_GP2X::hasFeature(Feature f) {