From 5d1ae85ab9829ab38b96277a8cd63e4539774e06 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 18 Jun 2011 18:44:01 +0300 Subject: Hand-picked Mac OSX cursor and bundle path fixes from https://bitbucket.org/toabi/minetest-mac --- src/porting.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/porting.cpp') diff --git a/src/porting.cpp b/src/porting.cpp index 7c7ce48ea..cce461be8 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -214,10 +214,28 @@ void initializePaths() */ #elif defined(__APPLE__) #include - + #include "CoreFoundation/CoreFoundation.h" + + // Code based on + // http://stackoverflow.com/questions/516200/relative-paths-not-working-in-xcode-c + CFBundleRef main_bundle = CFBundleGetMainBundle(); + CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL(main_bundle); + char path[PATH_MAX]; + if(CFURLGetFileSystemRepresentation(resources_url, TRUE, (UInt8 *)path, PATH_MAX)) + { + dstream<<"Bundle resource path: "< Date: Mon, 20 Jun 2011 07:56:45 +0300 Subject: moved the mac include in porting.cpp out of namespace --- src/porting.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/porting.cpp') diff --git a/src/porting.cpp b/src/porting.cpp index cce461be8..7de042ab5 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -27,6 +27,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "config.h" #include "debug.h" +#ifdef __APPLE__ + #include "CoreFoundation/CoreFoundation.h" +#endif + namespace porting { @@ -214,7 +218,6 @@ void initializePaths() */ #elif defined(__APPLE__) #include - #include "CoreFoundation/CoreFoundation.h" // Code based on // http://stackoverflow.com/questions/516200/relative-paths-not-working-in-xcode-c -- cgit v1.2.3