diff options
author | rubidium <rubidium@openttd.org> | 2007-06-17 15:48:57 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-06-17 15:48:57 +0000 |
commit | 347c28b71ac754aee20f8eeeae1df1a3b9a49d10 (patch) | |
tree | 8bc2a050b44170ed785af66e6e9045d429c789db /src/video/cocoa_v.mm | |
parent | 5fdde681c2aff0976eef8cea59422332527b3a65 (diff) | |
download | openttd-347c28b71ac754aee20f8eeeae1df1a3b9a49d10.tar.xz |
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
-Codechange: add support for personal directories on Windows.
-Fix [FS#153, FS#193, FS#502, FS#816, FS#854]: fix issues related to fixed names, fixed places of files/directories and application bundles.
Diffstat (limited to 'src/video/cocoa_v.mm')
-rw-r--r-- | src/video/cocoa_v.mm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/video/cocoa_v.mm b/src/video/cocoa_v.mm index bc4358912..950aa2b28 100644 --- a/src/video/cocoa_v.mm +++ b/src/video/cocoa_v.mm @@ -74,6 +74,7 @@ extern "C" void HideMenuBar(); #include "cocoa_keys.h" #include "../blitter/blitter.hpp" #include "../renderer/renderer.hpp" +#include "../fileio.h" #undef Point #undef Rect @@ -2059,6 +2060,22 @@ void CocoaDialog(const char* title, const char* message, const char* buttonLabel _cocoa_video_dialog = false; } +/* This is needed since OS X application bundles do not have a + * current directory and the data files are 'somewhere' in the bundle */ +void cocoaSetApplicationBundleDir() +{ + char tmp[MAXPATHLEN]; + CFURLRef url = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); + if (CFURLGetFileSystemRepresentation(url, true, (unsigned char*)tmp, MAXPATHLEN)) { + AppendPathSeparator(tmp, lengthof(tmp)); + _searchpaths[SP_APPLICATION_BUNDLE_DIR] = strdup(tmp); + } else { + _searchpaths[SP_APPLICATION_BUNDLE_DIR] = NULL; + } + + CFRelease(url); +} + /* These are called from main() to prevent a _NSAutoreleaseNoPool error when * exiting before the cocoa video driver has been loaded */ |