From 3553b83806f7a1e0c429596c5e2016af6e2e8ff2 Mon Sep 17 00:00:00 2001 From: ceylo Date: Sat, 28 Feb 2009 21:00:59 +0000 Subject: [PATCH] Using assertions instead of cerr logging. git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1030 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/System/Initializer.cpp | 37 ++++++--------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/src/SFML/System/Initializer.cpp b/src/SFML/System/Initializer.cpp index ad24a1ecc..8cdfdf407 100644 --- a/src/SFML/System/Initializer.cpp +++ b/src/SFML/System/Initializer.cpp @@ -54,48 +54,23 @@ void InitializeWorkingDirectory(void) // Get the application bundle CFBundleRef MainBundle = CFBundleGetMainBundle(); - - if (!MainBundle) - { - std::cerr << "Error getting the application main bundle" << std::endl; - return; - } + assert(MainBundle != NULL); // Get the resource directory URL CFURLRef ResourceDirectory = CFBundleCopyResourcesDirectoryURL(MainBundle); - - if (!ResourceDirectory) - { - std::cerr << "Error getting the resource directory of the main bundle" << std::endl; - return; - } + assert(ResourceDirectory != NULL); // Convert it as absolute URL CFURLRef AbsoluteURL = CFURLCopyAbsoluteURL(ResourceDirectory); - - if (!AbsoluteURL) - { - std::cerr << "Error getting the resource directory as an absolute URL" << std::endl; - CFRelease(ResourceDirectory); - return; - } + assert(AbsoluteURL != NULL); // Get the POSIX style path CFStringRef AbsolutePath = CFURLCopyFileSystemPath(AbsoluteURL, kCFURLPOSIXPathStyle); - - if (!AbsolutePath) - { - std::cerr << "Error converting the resource directory URL as a POSIX path" << std::endl; - CFRelease(AbsoluteURL); - CFRelease(ResourceDirectory); - return; - } + assert(AbsolutePath != NULL); // Get the path as C string and set it - if (CFStringGetCString(AbsolutePath, PathBuffer, 4096, kCFStringEncodingASCII)) - chdir(PathBuffer); - else - std::cerr << "Error copying the resource directory path in the C buffer" << std::endl; + assert(CFStringGetCString(AbsolutePath, PathBuffer, 4096, kCFStringEncodingASCII) == true); + assert(chdir(PathBuffer) == 0); CFRelease(AbsolutePath); CFRelease(AbsoluteURL);