Index: corelib/io/qdir.cpp =================================================================== --- corelib/io/qdir.cpp (revision 783508) +++ corelib/io/qdir.cpp (working copy) @@ -2160,7 +2160,7 @@ bool QDir::isRelativePath(const QString &path) { - return QFileInfo(path).isRelative(); + return QFSFileEngine::isRelativePath(path); } /*! Index: corelib/io/qfileinfo.cpp =================================================================== --- corelib/io/qfileinfo.cpp (revision 783508) +++ corelib/io/qfileinfo.cpp (working copy) @@ -706,7 +706,18 @@ return d->data->fileEngine->isRelativePath(); } +/*! + Returns true if \a path is relative; returns false if it is + absolute. + \sa isAbsolute() +*/ + +bool QFileInfo::isRelative(const QString &path) +{ + return QFSFileEngine::isRelativePath(path); +} + /*! Converts the file's path to an absolute path if it is not already in that form. Returns true to indicate that the path was converted; otherwise returns false Index: corelib/io/qfileinfo.h =================================================================== --- corelib/io/qfileinfo.h (revision 783508) +++ corelib/io/qfileinfo.h (working copy) @@ -132,6 +132,9 @@ bool caching() const; void setCaching(bool on); + static bool isRelative(const QString &path); + static inline bool isAbsolute(const QString &path) { return !isRelative(path); } + #ifdef QT3_SUPPORT enum Permission { ReadOwner = QFile::ReadOwner, WriteOwner = QFile::WriteOwner, ExeOwner = QFile::ExeOwner, Index: corelib/io/qfsfileengine.h =================================================================== --- corelib/io/qfsfileengine.h (revision 783508) +++ corelib/io/qfsfileengine.h (working copy) @@ -107,7 +107,8 @@ static QString rootPath(); static QString tempPath(); static QFileInfoList drives(); - + static bool isRelativePath(const QString &path); + static inline bool isAbsolutePath(const QString &path) { return !isRelativePath(path); } protected: QFSFileEngine(QFSFileEnginePrivate &dd); }; Index: corelib/io/qfsfileengine_unix.cpp =================================================================== --- corelib/io/qfsfileengine_unix.cpp (revision 783508) +++ corelib/io/qfsfileengine_unix.cpp (working copy) @@ -825,6 +825,13 @@ return d->filePath[0] != QLatin1Char('/'); } +bool QFSFileEngine::isRelativePath(const QString &path) +{ + if (path.size() == 0) + return true; + return path[0] != QLatin1Char('/'); +} + uint QFSFileEngine::ownerId(FileOwner own) const { Q_D(const QFSFileEngine); Index: corelib/io/qfsfileengine_win.cpp =================================================================== --- corelib/io/qfsfileengine_win.cpp (revision 783508) +++ corelib/io/qfsfileengine_win.cpp (working copy) @@ -1933,6 +1933,14 @@ || (d->filePath.at(0) == QLatin1Char('/') && d->filePath.at(1) == QLatin1Char('/'))))); // drive, e.g. a: } +bool QFSFileEngine::isRelativePath(const QString &path) +{ + return !(path.startsWith(QLatin1Char('/')) + || path.startsWith(QLatin1Char('\\')) + || (path.length() >= 2 && + ( (path.at(0).isLetter() && path.at(1) == QLatin1Char(':'))))); +} + /*! \reimp */