X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmain.cpp;h=2148861eb09228c317f8dc00fe00063e1c5170ff;hb=566f8eb2da26d5a2bb4ed5798a5774499f2e511f;hp=ade5d5d8df5990ac2eb7da955adbf1ede11ade89;hpb=9aa7909e583ee203065b37d75169cb1dcbfcdf12;p=supertux.git diff --git a/src/main.cpp b/src/main.cpp index ade5d5d8d..2148861eb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,6 +34,10 @@ #include #include +#ifdef MACOSX +# include +#endif + #include "gameconfig.hpp" #include "resources.hpp" #include "gettext.hpp" @@ -165,8 +169,18 @@ static void init_physfs(const char* argv0) #ifdef MACOSX // when started from Application file on Mac OS X... - dir = PHYSFS_getBaseDir(); - dir += "SuperTux.app/Contents/Resources/data"; + char path[PATH_MAX]; + CFBundleRef mainBundle = CFBundleGetMainBundle(); + assert(mainBundle != 0); + CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); + assert(mainBundleURL != 0); + CFStringRef pathStr = CFUrlCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); + assert(pathStr != 0); + CFStringGetCString(pathStr, path, PATH_MAX, kCFStringEncodingUTF8); + CFRelease(mainBundleURL); + CFRelease(pathStr); + + dir = std::string(path) + "/Contents/Resources/data"; testfname = dir + "/credits.txt"; sourcedir = false; f = fopen(testfname.c_str(), "r"); @@ -582,7 +596,6 @@ int main(int argc, char** argv) delete main_loop; main_loop = NULL; - free_options_menu(); unload_shared(); quit_audio();