mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Add a bit of support for obsolete windows systems.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21575 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d326c9ce1c
commit
660b3e0e97
2 changed files with 37 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
|||
2005-07-30 Jeremy Bettis
|
||||
|
||||
* Source/NSData.m: Support write to file for windows9x users.
|
||||
|
||||
2005-07-27 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/Makefile.postamble (Info-gnustep.plist): Depend on
|
||||
|
|
|
@ -1009,6 +1009,35 @@ static unsigned gsu32Align;
|
|||
{
|
||||
c = 0;
|
||||
}
|
||||
/* Windows 9x does not support MoveFileEx */
|
||||
else if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
{
|
||||
unichar secondaryFile[length + 100];
|
||||
|
||||
wcscpy(secondaryFile, wthePath);
|
||||
wcscat(secondaryFile, L"-delete");
|
||||
// Delete the intermediate name just in case
|
||||
DeleteFileW(secondaryFile);
|
||||
// Move the existing file to the temp name
|
||||
if (MoveFileW(wtheRealPath, secondaryFile) != 0)
|
||||
{
|
||||
if (MoveFileW(wthePath, wtheRealPath) != 0)
|
||||
{
|
||||
c = 0;
|
||||
// Delete the old file if possible
|
||||
DeleteFileW(secondaryFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
c = -1; // failure, restore the old file if possible
|
||||
MoveFileW(secondaryFile, wtheRealPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
c = -1; // failure
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
c = -1;
|
||||
|
@ -1021,11 +1050,12 @@ static unsigned gsu32Align;
|
|||
{
|
||||
#if defined(__MINGW__)
|
||||
NSWarnMLog(@"Rename ('%@' to '%@') failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
[NSString stringWithCharacters:wtheRealPath length:wcslen(wtheRealPath)],
|
||||
[NSString stringWithCharacters: wthePath length:wcslen(wthePath)],
|
||||
[NSString stringWithCharacters:
|
||||
wtheRealPath length:wcslen(wtheRealPath)],
|
||||
GSLastErrorStr(errno));
|
||||
#else
|
||||
NSWarnMLog(@"Rename ('%s' to '%s') failed - %s",
|
||||
NSWarnMLog(@"Rename ('%s' to '%s') failed - %s",
|
||||
thePath, theRealPath, GSLastErrorStr(errno));
|
||||
#endif
|
||||
goto failure;
|
||||
|
|
Loading…
Reference in a new issue