@@ -39,10 +39,16 @@ # include #endif #ifdef HAVE_GRP_H # include #endif + +#ifdef __wii__ +# define BOOL OGC_BOOL +# include +# undef BOOL +#endif #import "OFFile.h" #import "OFString.h" #import "OFArray.h" #ifdef OF_HAVE_THREADS @@ -131,21 +137,27 @@ return -1; } @implementation OFFile -#if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) + (void)initialize { if (self != [OFFile class]) return; +#if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) if (!of_mutex_new(&mutex)) @throw [OFInitializationFailedException exceptionWithClass: self]; -} +#endif + +#ifdef __wii__ + if (!fatInitDefault()) + @throw [OFInitializationFailedException + exceptionWithClass: self]; #endif +} + (instancetype)fileWithPath: (OFString*)path mode: (OFString*)mode { return [[[self alloc] initWithPath: path @@ -286,11 +298,11 @@ if ((dir = opendir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) @throw [OFOpenFileFailedException exceptionWithClass: self path: path - mode: @"r"]; + mode: @"r"]; @try { while ((dirent = readdir(dir)) != NULL) { void *pool = objc_autoreleasePoolPush(); OFString *file;