port latest gc canges to windows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28090 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-03-18 08:50:32 +00:00
parent 1549f5b5e7
commit b0c507570a
8 changed files with 90 additions and 80 deletions

View file

@ -79,6 +79,7 @@
#include "Foundation/NSPathUtilities.h"
#include "Foundation/NSRange.h"
#include "Foundation/NSURL.h"
#include "Foundation/NSValue.h"
#include "Foundation/NSZone.h"
#include "GSPrivate.h"
#include <stdio.h>
@ -987,6 +988,9 @@ failure:
{
NSFileManager *mgr = [NSFileManager defaultManager];
NSMutableDictionary *att = nil;
#if defined(__MINGW32__)
NSUInteger perm;
#endif
if ([mgr fileExistsAtPath: path])
{
@ -996,6 +1000,15 @@ failure:
}
#if defined(__MINGW32__)
/* To replace the existing file on windows, it must be writable.
*/
perm = [att filePosixPermissions];
if (perm != NSNotFound && (perm & 0200) == 0)
{
[mgr changeFileAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithUnsignedInt: 0777], NSFilePosixPermissions,
nil] atPath: path];
}
/*
* The windoze implementation of the POSIX rename() function is buggy
* and doesn't work if the destination file already exists ... so we