@@ -30,10 +30,11 @@ #endif #import "OFFile.h" #import "OFLocale.h" #import "OFString.h" +#import "OFSystemInfo.h" #import "OFURL.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFNotOpenException.h" @@ -218,20 +219,27 @@ if ((flags = parseMode(mode.UTF8String)) == -1) @throw [OFInvalidArgumentException exception]; flags |= O_BINARY | O_CLOEXEC; -# if defined(OF_WINDOWS) - if ((handle = _wopen(path.UTF16String, flags, - _S_IREAD | _S_IWRITE)) == -1) -# elif defined(HAVE_OPEN64) - if ((handle = open64([path cStringWithEncoding: - [OFLocale encoding]], flags, 0666)) == -1) +# ifdef OF_WINDOWS + if ([OFSystemInfo isWindowsNT]) + handle = _wopen(path.UTF16String, flags, + _S_IREAD | _S_IWRITE); + else +# endif +# ifdef HAVE_OPEN64 + handle = open64( + [path cStringWithEncoding: [OFLocale encoding]], + flags, 0666); # else - if ((handle = open([path cStringWithEncoding: - [OFLocale encoding]], flags, 0666)) == -1) + handle = open( + [path cStringWithEncoding: [OFLocale encoding]], + flags, 0666); # endif + + if (handle == -1) @throw [OFOpenItemFailedException exceptionWithPath: path mode: mode errNo: errno]; #else