'lightweight' QDir::isAbsolutePath replacement ?

Ralf Habacker ralf.habacker at freenet.de
Mon Mar 17 11:08:16 GMT 2008


Thiago Macieira schrieb:
> On Friday 14 March 2008 14:56:16 Ralf Habacker wrote:
>   
>> bool QDir::isRelativePath(const QString &path)
>> {
>>     bool a = QFileInfo(path).isRelative();
>>     bool b = QFileInfo::isRelative(path);
>>     if (a != b)
>>         qDebug() << path << a << b;
>>     return a;
>> }
>>
>>     
> [snip]
>   
>> it looks that the new implementation seems to assume that a path
>> starting with '\' is a relative path.
>>     
>
> Ah, I see! It's missing the conversion to Qt separators.
>
>
>   
Wasn't this case covered by your test case ?
I used  the following pattern

    QStringList isAbsolutePattern;
    isAbsolutePattern << "" << "/" << "\\" << "C:/fdfdf" << "c:\\dfdffd" 
<< "/edrfdfdf" << "\\dfdfdfdf" << "\\\\dfdfdfdf";
    QStringList isRelativePattern;
    isRelativePattern << "sdsd" << "Cssss" << "." ;


Ralf






More information about the kde-core-devel mailing list