gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData -writeToFile:options:error: on MinGW


From: Wolfgang Lux
Subject: Re: NSData -writeToFile:options:error: on MinGW
Date: Sat, 7 Feb 2015 11:09:50 +0100

> Am 07.02.2015 um 08:16 schrieb Germán Arias <address@hidden>:
> 
> After solve the problem with pthread and nanosleep (change the
> parts/time.h header on MinGW and change config.h, in gnustep base, to
> don't use nanosleep) I have other problem. The configure script now
> defines HAVE_MKSTEMP to 1, used in -writeToFile:options:error: in
> NSData. This part of code isn't mingw compatible, so I add some changes
> (see attached patch). However a simple test fail. This program:
> 
> NSData *dat = [NSData dataWithContentsOfFile:
> @"/MinGW/msys/home/German/src.txt"];
> 
> [dat writeToFile: @"c:/MinGW/msys/home/German/test.txt" atomically:
> YES];
> 
> Always wrote the temporary file at current directory. So the NSData
> object can't rename this later. What I'm doing wrong? Or is this a bug
> on Base?

Your patch looks wrong to me. Looking at the definitions of wthePath and 
wtheRealPath, these variables are wide character strings. So you must not use 
the standard string functions strncpy and strncat to copy and modify these 
variables, but instead you should use their wide character variants wcsncpy and 
wcsncat.

Wolfgang




reply via email to

[Prev in Thread] Current Thread [Next in Thread]