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
This commit is contained in:
ceylo 2009-03-01 23:29:04 +00:00
parent 6f6014b5dd
commit 66681bc1ae

View File

@ -32,6 +32,7 @@
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include <iostream> #include <iostream>
#include <cstdio>
namespace sf namespace sf
{ {
@ -51,6 +52,7 @@ void InitializeWorkingDirectory(void) __attribute__ ((constructor));
void InitializeWorkingDirectory(void) void InitializeWorkingDirectory(void)
{ {
char PathBuffer[4096]; char PathBuffer[4096];
bool Encoded = false;
// Get the application bundle // Get the application bundle
CFBundleRef MainBundle = CFBundleGetMainBundle(); CFBundleRef MainBundle = CFBundleGetMainBundle();
@ -64,15 +66,13 @@ void InitializeWorkingDirectory(void)
CFURLRef AbsoluteURL = CFURLCopyAbsoluteURL(ResourceDirectory); CFURLRef AbsoluteURL = CFURLCopyAbsoluteURL(ResourceDirectory);
assert(AbsoluteURL != NULL); assert(AbsoluteURL != NULL);
// Get the POSIX style path // Get the path as C string
CFStringRef AbsolutePath = CFURLCopyFileSystemPath(AbsoluteURL, kCFURLPOSIXPathStyle); Encoded = CFURLGetFileSystemRepresentation(AbsoluteURL, true, (UInt8 *)PathBuffer, 4096);
assert(AbsolutePath != NULL); assert(Encoded);
// Get the path as C string and set it // Set the working directory
assert(CFStringGetCString(AbsolutePath, PathBuffer, 4096, kCFStringEncodingASCII) == true); chdir(PathBuffer);
assert(chdir(PathBuffer) == 0);
CFRelease(AbsolutePath);
CFRelease(AbsoluteURL); CFRelease(AbsoluteURL);
CFRelease(ResourceDirectory); CFRelease(ResourceDirectory);
} }