All pastes #1904993 Raw Edit

Anonymous

public diff v1 · immutable
#1904993 ·published 2010-07-21 03:08 UTC
rendered paste body
Index: src/main.c===================================================================--- src/main.c	(revision 11240)+++ src/main.c	(working copy)@@ -22,6 +22,7 @@  */  // Get platform defines before checking for them!+#include "lib/framework/wzglobal.h" #include "lib/framework/frame.h"  #include <SDL.h>@@ -612,11 +613,8 @@  #ifdef WZ_OS_MAC 	if( !PHYSFS_exists("gamedesc.lev") ) {-		CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); 		char resourcePath[PATH_MAX];-		if( CFURLGetFileSystemRepresentation( resourceURL, true,-							(UInt8 *) resourcePath,-							PATH_MAX) ) {+		if( getMacResourcePath(resourcePath, PATH_MAX) ) { 			chdir( resourcePath ); 			registerSearchPath( "data", 7 ); 			rebuildSearchPath( mod_multiplay, true );Index: lib/framework/i18n.c===================================================================--- lib/framework/i18n.c	(revision 11240)+++ lib/framework/i18n.c	(working copy)@@ -23,10 +23,7 @@  #include "string_ext.h" -#ifdef WZ_OS_MAC-# include <CoreFoundation/CoreFoundation.h>-# include <CoreFoundation/CFURL.h>-#endif+#include "wzglobal.h"  /* Always use fallbacks on Windows */ #if defined(WZ_OS_WIN)@@ -389,8 +386,8 @@ 	#ifdef WZ_OS_MAC 	{ 		char resourcePath[PATH_MAX];-		CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());-		if( CFURLGetFileSystemRepresentation( resourceURL, true, (UInt8 *) resourcePath, PATH_MAX) )++		if (getMacResourcePath(resourcePath, PATH_MAX)) 		{ 			sstrcat(resourcePath, "/locale"); 			textdomainDirectory = bindtextdomain(PACKAGE, resourcePath);Index: lib/framework/wzglobal.h===================================================================--- lib/framework/wzglobal.h	(revision 11240)+++ lib/framework/wzglobal.h	(working copy)@@ -611,4 +611,29 @@ # define va_copy(dest, src) (void)((dest) = (src)) #endif // !WZ_C99 && !va_copy +#ifdef WZ_OS_MAC+/*!+ * Get the application's main bundle path.+ * \param resourcePath Buffer to hold the of the ressource path+ * 						in the filesystem's native representation.+ * \param size Size of resourcePath+ */+inline bool getMacResourcePath(char * resourcePath, size_t size)+{+	CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());+	bool retVal;++	if (resourceURL == NULL)+	{+		return false;+	}++	retVal = CFURLGetFileSystemRepresentation(resourceURL, true, (UInt8 *) resourcePath, size));++	CFRelease(resourceURL);++	return retVal;+}+#endif // WZ_OS_MAC+ #endif /* WZGLOBAL_H */Index: lib/ivis_opengl/textdraw.c===================================================================--- lib/ivis_opengl/textdraw.c	(revision 11240)+++ lib/ivis_opengl/textdraw.c	(working copy)@@ -33,9 +33,9 @@ #include "lib/ivis_common/textdraw.h" #include "lib/ivis_common/bitimage.h" +#include "lib/framework/wzglobal.h" // For Mac path function+ #ifdef WZ_OS_MAC-# include <CoreFoundation/CoreFoundation.h>-# include <CoreFoundation/CFURL.h> # include <QuesoGLC/glc.h> #else # include <GL/glc.h>@@ -136,8 +136,8 @@ 	#ifdef WZ_OS_MAC 	{ 		char resourcePath[PATH_MAX];-		CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());-		if (CFURLGetFileSystemRepresentation(resourceURL, true, (UInt8 *) resourcePath, PATH_MAX))++		if (getMacResourcePath(resourcePath, PATH_MAX)) 		{ 			sstrcat(resourcePath, "/Fonts"); 			glcAppendCatalog(resourcePath);