QT_BEGIN_NAMESPACE
+#ifdef Q_OS_WIN
static QString driveSpec(const QString &path)
{
-#if defined(Q_OS_WIN)
if (path.size() < 2)
return QString();
char c = path.at(0).toAscii();
if (path.at(1).toAscii() != ':')
return QString();
return path.mid(0, 2);
-#else
- Q_UNUSED(path);
- return QString();
-#endif
}
+#endif
//************* QDirPrivate
QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, QDir::SortFlags sort_, QDir::Filters filters_)
if (isRelativePath(file) || isRelativePath(dir))
return file;
+#ifdef Q_OS_WIN
QString dirDrive = driveSpec(dir);
QString fileDrive = driveSpec(file);
fileDriveMissing = true;
}
-#ifdef Q_OS_WIN
if (fileDrive.toLower() != dirDrive.toLower()
|| (file.startsWith(QLatin1String("//"))
&& !dir.startsWith(QLatin1String("//"))))
-#else
- if (fileDrive != dirDrive)
-#endif
return file;
dir.remove(0, dirDrive.size());
if (!fileDriveMissing)
file.remove(0, fileDrive.size());
+#else
+ if (file.startsWith(QLatin1String("//"))
+ && !dir.startsWith(QLatin1String("//")))
+ return file;
+#endif
QString result;
QStringList dirElts = dir.split(QLatin1Char('/'), QString::SkipEmptyParts);