@@ -55,11 +55,11 @@ #import "OFReadFailedException.h" #import "OFRemoveItemFailedException.h" #import "OFStatItemFailedException.h" #import "OFUnlockFailedException.h" -#ifdef _WIN32 +#ifdef OF_WINDOWS # include # include #endif #ifndef S_IRGRP @@ -81,18 +81,18 @@ static OFFileManager *defaultManager; #if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) static of_mutex_t chownMutex; #endif -#if !defined(HAVE_READDIR_R) && !defined(_WIN32) && defined(OF_HAVE_THREADS) +#if !defined(HAVE_READDIR_R) && !defined(OF_WINDOWS) && defined(OF_HAVE_THREADS) static of_mutex_t readdirMutex; #endif int of_stat(OFString *path, of_stat_t *buffer) { -#if defined(_WIN32) +#if defined(OF_WINDOWS) return _wstat64([path UTF16String], buffer); #elif defined(OF_HAVE_OFF64_T) return stat64([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], buffer); #else @@ -102,11 +102,11 @@ } int of_lstat(OFString *path, of_stat_t *buffer) { -#if defined(_WIN32) +#if defined(OF_WINDOWS) return _wstat64([path UTF16String], buffer); #elif defined(HAVE_LSTAT) # ifdef OF_HAVE_OFF64_T return lstat64([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], buffer); @@ -141,11 +141,11 @@ if (!of_mutex_new(&chownMutex)) @throw [OFInitializationFailedException exceptionWithClass: self]; #endif -#if !defined(HAVE_READDIR_R) && !defined(_WIN32) && defined(OF_HAVE_THREADS) +#if !defined(HAVE_READDIR_R) && !defined(OF_WINDOWS) && defined(OF_HAVE_THREADS) if (!of_mutex_new(&readdirMutex)) @throw [OFInitializationFailedException exceptionWithClass: self]; #endif @@ -158,18 +158,18 @@ } - (OFString*)currentDirectoryPath { OFString *ret; -#ifndef _WIN32 +#ifndef OF_WINDOWS char *buffer = getcwd(NULL, 0); #else wchar_t *buffer = _wgetcwd(NULL, 0); #endif @try { -#ifndef _WIN32 +#ifndef OF_WINDOWS ret = [OFString stringWithCString: buffer encoding: [OFSystemInfo native8BitEncoding]]; #else ret = [OFString stringWithUTF16String: buffer]; @@ -234,11 +234,11 @@ - (void)createDirectoryAtPath: (OFString*)path { if (path == nil) @throw [OFInvalidArgumentException exception]; -#ifndef _WIN32 +#ifndef OF_WINDOWS if (mkdir([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], DIR_MODE) != 0) #else if (_wmkdir([path UTF16String]) != 0) #endif @@ -291,20 +291,20 @@ } - (OFArray*)contentsOfDirectoryAtPath: (OFString*)path { OFMutableArray *files; -#ifndef _WIN32 +#ifndef OF_WINDOWS of_string_encoding_t encoding; #endif if (path == nil) @throw [OFInvalidArgumentException exception]; files = [OFMutableArray array]; -#ifndef _WIN32 +#ifndef OF_WINDOWS DIR *dir; encoding = [OFSystemInfo native8BitEncoding]; if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL) @@ -416,11 +416,11 @@ - (void)changeCurrentDirectoryPath: (OFString*)path { if (path == nil) @throw [OFInvalidArgumentException exception]; -#ifndef _WIN32 +#ifndef OF_WINDOWS if (chdir([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]]) != 0) #else if (_wchdir([path UTF16String]) != 0) #endif @@ -493,11 +493,11 @@ permissions: (mode_t)permissions { if (path == nil) @throw [OFInvalidArgumentException exception]; -# ifndef _WIN32 +# ifndef OF_WINDOWS if (chmod([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], permissions) != 0) # else if (_wchmod([path UTF16String], permissions) != 0) # endif @@ -720,11 +720,11 @@ - (void)moveItemAtPath: (OFString*)source toPath: (OFString*)destination { void *pool; of_stat_t s; -#ifndef _WIN32 +#ifndef OF_WINDOWS of_string_encoding_t encoding; #endif if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; @@ -735,11 +735,11 @@ @throw [OFCopyItemFailedException exceptionWithSourcePath: source destinationPath: destination errNo: EEXIST]; -#ifndef _WIN32 +#ifndef OF_WINDOWS encoding = [OFSystemInfo native8BitEncoding]; if (rename([source cStringWithEncoding: encoding], [destination cStringWithEncoding: encoding]) != 0) { #else @@ -822,11 +822,11 @@ objc_autoreleasePoolPop(pool2); } } -#ifndef _WIN32 +#ifndef OF_WINDOWS if (remove([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]]) != 0) #else if (_wremove([path UTF16String]) != 0) #endif