diff options
Diffstat (limited to 'src/corelib/io/qstandardpaths_unix.cpp')
-rw-r--r-- | src/corelib/io/qstandardpaths_unix.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index f0ff46fe7f..e49edd9a40 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -42,6 +42,7 @@ #include <qfile.h> #include <qhash.h> #include <qtextstream.h> +#include <qregularexpression.h> #include <private/qfilesystemengine_p.h> #include <errno.h> #include <stdlib.h> @@ -169,7 +170,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) break; } -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(regularexpression) // http://www.freedesktop.org/wiki/Software/xdg-user-dirs QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME")); if (xdgConfigHome.isEmpty()) @@ -179,11 +180,12 @@ QString QStandardPaths::writableLocation(StandardLocation type) QHash<QString, QString> lines; QTextStream stream(&file); // Only look for lines like: XDG_DESKTOP_DIR="$HOME/Desktop" - QRegExp exp(QLatin1String("^XDG_(.*)_DIR=(.*)$")); + QRegularExpression exp(QLatin1String("^XDG_(.*)_DIR=(.*)$")); while (!stream.atEnd()) { const QString &line = stream.readLine(); - if (exp.indexIn(line) != -1) { - const QStringList lst = exp.capturedTexts(); + QRegularExpressionMatch match = exp.match(line); + if (match.hasMatch()) { + const QStringList lst = match.capturedTexts(); const QString key = lst.at(1); QString value = lst.at(2); if (value.length() > 2 @@ -230,7 +232,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) } } } -#endif +#endif // QT_CONFIG(regularexpression) QString path; switch (type) { |