From kde-windows Thu Mar 06 18:54:41 2008 From: Ralf Habacker Date: Thu, 06 Mar 2008 18:54:41 +0000 To: kde-windows Subject: Re: 'lightweight' QDir::isAbsolutePath replacement ? Message-Id: <47D03DF1.9050305 () freenet ! de> X-MARC-Message: https://marc.info/?l=kde-windows&m=120483043816482 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