Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -532,11 +532,15 @@ + (void)copyItemAtPath: (OFString*)source toPath: (OFString*)destination { void *pool; +#ifndef _WIN32 struct stat s; +#else + struct _stat s; +#endif if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); @@ -545,11 +549,15 @@ OFArray *components = [OFArray arrayWithObjects: destination, [source lastPathComponent], nil]; destination = [OFString pathWithComponents: components]; } +#ifndef _WIN32 if (lstat([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s)) +#else + if (_wstat([source UTF16String], &s)) +#endif @throw [OFCopyItemFailedException exceptionWithSourcePath: source destinationPath: destination]; if (S_ISREG(s.st_mode)) { @@ -620,10 +628,11 @@ destinationPath: destination]; } enumerator = [contents objectEnumerator]; while ((item = [enumerator nextObject]) != nil) { + void *pool2 = objc_autoreleasePoolPush(); OFArray *components; OFString *sourcePath, *destinationPath; components = [OFArray arrayWithObjects: source, item, nil]; @@ -634,10 +643,12 @@ destinationPath = [OFString pathWithComponents: components]; [OFFile copyItemAtPath: sourcePath toPath: destinationPath]; + + objc_autoreleasePoolPop(pool2); } #ifdef OF_HAVE_SYMLINK } else if (S_ISLNK(s.st_mode)) { @try { if ([OFFile symbolicLinkExistsAtPath: destination] ||