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 <iostream>
#include <cstdio>
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);
}