wxMac 2.8.7: problem reading date of files with unusual chars in file name

Stefan Csomor csomor at advancedconcepts.ch
Tue Feb 12 05:14:04 PST 2008


Hi Fulvio

that's precisely the spot, thanks for discovering it

Thanks,

Stefan


On 2/12/08 9:25 AM, "Fulvio Senore" <mailing at fsoft.it> wrote:

> I think that I have found a fix for that problem.
> 
> The file src/common/filename.cpp contains wxFilename::GetTimes()
> 
> line 2285:
> 
> if ( wxStat( GetFullPath().c_str(), &stBuf) == 0 )
> 
> should be changed to
> 
> if ( wxStat( GetFullPath().fn_str(), &stBuf) == 0 )
> 
> 
> Fulvio Senore
> 
> 
> Fulvio Senore ha scritto:
>> I am using the following code to read info about the files contained
>> in a folder:
>> 
>> 
>> wxDir dir(path);
>> bool cont = dir.GetFirst(&fileName, wxT(""), wxDIR_FILES );
>> while( cont ) {
>>    wxFileName fn( path, fileName );
>>    CFiles file;
>>    file.FileName = fileName;
>>    file.FileExt = fn.GetExt();
>>    file.DateTime = fn.GetModificationTime();
>>    file.FileSize = fn.GetSize();
>>    file.PathID = pth.PathID;
>>    file.PathFileID.SetNull(true);
>>    file.DbInsert();
>>    cont = dir.GetNext(&fileName);
>> }
>> 
>> 
>> This code works well in Linux and Windows. In OSX, if one or more file
>> names contain letters like "èéà°" I receive errors saying:
>> 
>> "failed to retrieve file times for <file name> (error 2: no such file
>> or directory)"
>> 
>> if the file name does not contain those letters the program works
>> without problems.
>> 
>> I have verified that the line that causes the problem is the one that
>> calls the GetModificationTime() function.
>> 
>> It looks like those letters are not handled correctly.
>> 
>> Best regards
>> 
>> Fulvio Senore
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
>> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>> 
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
> 

-- 

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-users mailing list