From 66681bc1ae3d4d2164fcd6a4e049945f97dfe667 Mon Sep 17 00:00:00 2001 From: ceylo Date: Sun, 1 Mar 2009 23:29:04 +0000 Subject: [PATCH] Dropped some assert() calls preventing some functions from being called. git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1035 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/System/Initializer.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/SFML/System/Initializer.cpp b/src/SFML/System/Initializer.cpp index 8cdfdf40..161ae999 100644 --- a/src/SFML/System/Initializer.cpp +++ b/src/SFML/System/Initializer.cpp @@ -32,6 +32,7 @@ #include #include +#include namespace sf { @@ -51,6 +52,7 @@ void InitializeWorkingDirectory(void) __attribute__ ((constructor)); void InitializeWorkingDirectory(void) { char PathBuffer[4096]; + bool Encoded = false; // Get the application bundle CFBundleRef MainBundle = CFBundleGetMainBundle(); @@ -64,15 +66,13 @@ void InitializeWorkingDirectory(void) CFURLRef AbsoluteURL = CFURLCopyAbsoluteURL(ResourceDirectory); assert(AbsoluteURL != NULL); - // Get the POSIX style path - CFStringRef AbsolutePath = CFURLCopyFileSystemPath(AbsoluteURL, kCFURLPOSIXPathStyle); - assert(AbsolutePath != NULL); + // Get the path as C string + Encoded = CFURLGetFileSystemRepresentation(AbsoluteURL, true, (UInt8 *)PathBuffer, 4096); + assert(Encoded); - // Get the path as C string and set it - assert(CFStringGetCString(AbsolutePath, PathBuffer, 4096, kCFStringEncodingASCII) == true); - assert(chdir(PathBuffer) == 0); + // Set the working directory + chdir(PathBuffer); - CFRelease(AbsolutePath); CFRelease(AbsoluteURL); CFRelease(ResourceDirectory); }