From b4f8ea7fda5619cd83c3117778d40a25d8c9f50a Mon Sep 17 00:00:00 2001 From: CaS Date: Mon, 16 Sep 2002 14:04:24 +0000 Subject: [PATCH] Tidyups and fixes for windows. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14458 72102866-910b-0410-8b05-ffd578937521 --- Source/NSData.m | 21 +++++++++++++++++++++ Source/NSFileManager.m | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Source/NSData.m b/Source/NSData.m index 6230da089..1f44a7aad 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -911,7 +911,28 @@ failure: IF_NO_GC(TEST_AUTORELEASE(att)); } +#if defined(__NEW__MINGW__) + if (ReplaceFile(theRealPath, thePath, 0, + REPLACEFILE_IGNORE_MERGE_ERRORS, 0, 0) != 0) + { + c = 0; + } + else + { + c = -1; + } +#else c = rename(thePath, theRealPath); +#if defined(__MINGW__) + if (c != 0) + { + NSLog(@"Rename ('%s' to '%s') failed - %s trying delete first.", + thePath, theRealPath, GSLastErrorStr(errno)); + DeleteFile(theRealPath); // Non-atomic! + c = rename(thePath, theRealPath); + } +#endif +#endif if (c != 0) /* Many things could go wrong, I guess. */ { NSLog(@"Rename ('%s' to '%s') failed - %s", diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index 6d374e36a..2bff0e351 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -165,7 +165,7 @@ @interface GSAttrDictionary : NSDictionary { #ifdef __MINGW__ - const char *name; + char *name; #endif struct stat statbuf; } @@ -2626,7 +2626,7 @@ static NSSet *fileKeys = nil; { #ifdef __MINGW__ if (name != 0) - NSZoneFree(name); + NSZoneFree(NSDefaultMallocZone(), name); #endif [super dealloc]; }