[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-windows
Subject:    Re: 'lightweight' QDir::isAbsolutePath replacement ?
From:       Ralf Habacker <ralf.habacker () freenet ! de>
Date:       2008-03-06 18:54:41
Message-ID: 47D03DF1.9050305 () freenet ! de
[Download RAW message or body]

Ralf Habacker schrieb:
> Hi,
>
> there are several places in the kde code which needs a check if a path 
> is absolute. On unix this is mainly done by using  
> QString::startsWith('/'), which does not work as expected on windows.
>
> The only static method Qt provides to handle this platform independent 
> is QDir::isAbsolutePath(). Unfortunally this method seems to be very 
> time expensive because it creates a temporary QDir instance.
One little correction: I fact QDir::isAbsolutePath() creates a QFileInfo 
instance instead of QDir but the problems still remains.

qdir.h
    static bool isRelativePath(const QString &path);
    inline static bool isAbsolutePath(const QString &path) { return 
!isRelativePath(path); }

qdir.cpp
bool QDir::isRelativePath(const QString &path)
{
    return QFileInfo(path).isRelative();
}

Ralf

_______________________________________________
Kde-windows mailing list
Kde-windows@kde.org
https://mail.kde.org/mailman/listinfo/kde-windows
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic