[Patch] - Port kded/vfolder_menu.cpp to QDirIterator

Thiago Macieira thiago at kde.org
Mon Feb 23 22:20:22 GMT 2009


Christian Ehrlicher wrote:
>David Faure schrieb:
>> On Sunday 22 February 2009, Christian Ehrlicher wrote:
>>> Hi,
>>>
>>> attached you can find a patch to port vfolder_menu.cpp to
>>> QDirIterator to resolve possible problems with filename encodings on
>>> windows.
>>>
>>> I'm unsure about ::stat(), S_ISREG ( buff.st_mode ) <->
>>> QFileInfo::isFile() when a file is a symlink. Maybe someone can take
>>> a look on it if I did it right.
>>
>> stat() follows symlinks (unlike lstat), so stat+S_ISREG would say true
>> for a symlink-to-a-file (and false for a symlink-to-a-dir).
>> But QFileInfo::isFile() works exactly the same way, so no problem,
>> just test for isFile(), no need for isSymLink().
>>
>> On that note, please make sure symlinks to dirs are followed too.
>> That's what the DT_LNK was added for. Bug 150307.
>
>According to the docs isDir() should also recognize symlinks:
>"Returns true if this object points to a directory or to a symbolic link
>to a directory"

QFileInfo does both stat(2) and lstat(2) on-demand. That means you get to 
find out if a file is a symlink (isSymlink) and what it points to.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090223/80431cf2/attachment.sig>


More information about the kde-core-devel mailing list