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: Richard Frith-Macdonald
Subject: Re: NSData -writeToFile:options:error: on MinGW
Date: Sat, 7 Feb 2015 10:33:56 +0000

On 7 Feb 2015, at 10:09, Wolfgang Lux <address@hidden> wrote:
> 
> 
>> 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.

I think the code assumes HAVE_MKSTEMP will not be defined on mingw ... so the 
thing to do is make that explicit ... there's no point trying to use mkstem() 
on a windows system since there's already a native function we call to do the 
job.


reply via email to

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