[wx-dev] Re: SVN:(SC) [51735] adding filename conversion for wxStat

Stefan Csomor csomor at advancedconcepts.ch
Wed Feb 13 21:05:39 PST 2008


Hi Vadim

> On Wed, 13 Feb 2008 22:19:02 +0100 Stefan Csomor <csomor at advancedconcepts.ch>
> wrote:
> 
> SC> the problem in unicode is that wxNEED_WX_UNISTD_H gets defined resulting
> in
> SC> the other implementation,
> 
>  Sorry, something seems to be missing in this sentence?

I wanted to point out that it is not using just a #define but using a
different code piece - that's why what is below happens, it is different to
pure #defines like eg wxRmDir

> SC> using stat and fn_str() works in both builds,
> SC> using wxStat would be wrong in the unicode situation as it would convert
> yet
> SC> again using wxConvFile (in the code in filefn.cpp 133)
> 
>  Something is clearly wrong if using wxStat() doesn't work in Unicode
> build. But I don't really see why doesn't it: as wxMBFILES should be set
> for wxMac, fn_str() should convert the internally stored wchar_t string to
> (decomposed) UTF-8 just as intended.
> 
>  So what exactly is the problem?

the problem is not unicode, but non-unicode: The way the code WAS,

    if ( wxStat( GetFullPath().c_str()

a conversion using wxConvFile was not happening in non-unicode, but it would
be needed there as well at least on OS X, not only in unicode when it
already was happening. So in order to avoid a double wxConvFile conversion,
we'd have to change to either

#ifndef wxNEED_WX_UNISTD_H
    if ( wxStat( GetFullPath().fn_str() ..
#else
    if ( wxStat( GetFullPath() ..
#endif

or

    if( stat( GetFullPath().fn_str()

Best,

Stefan


-- 

Advanced Concepts AG
Software-Engineering
Heldweg 10   
CH-8475 Ossingen
Switzerland

phone:+41 52 245 0 245
fax:+41 52 245 0 246
http://www.advanced.ch
mailto:csomor at advanced.ch








More information about the wx-dev mailing list