forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.12'
Change-Id: Id1c063ae716c3acf5e6201c15663637040aa9a35
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
#include <QOperatingSystemVersion>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <qplatformdefs.h>
|
||||
@@ -330,10 +330,10 @@ QString FilePath::shortNativePath() const
|
||||
QString FileUtils::fileSystemFriendlyName(const QString &name)
|
||||
{
|
||||
QString result = name;
|
||||
result.replace(QRegExp(QLatin1String("\\W")), QLatin1String("_"));
|
||||
result.replace(QRegExp(QLatin1String("_+")), QLatin1String("_")); // compact _
|
||||
result.remove(QRegExp(QLatin1String("^_*"))); // remove leading _
|
||||
result.remove(QRegExp(QLatin1String("_+$"))); // remove trailing _
|
||||
result.replace(QRegularExpression(QLatin1String("\\W")), QLatin1String("_"));
|
||||
result.replace(QRegularExpression(QLatin1String("_+")), QLatin1String("_")); // compact _
|
||||
result.remove(QRegularExpression(QLatin1String("^_*"))); // remove leading _
|
||||
result.remove(QRegularExpression(QLatin1String("_+$"))); // remove trailing _
|
||||
if (result.isEmpty())
|
||||
result = QLatin1String("unknown");
|
||||
return result;
|
||||
@@ -341,8 +341,8 @@ QString FileUtils::fileSystemFriendlyName(const QString &name)
|
||||
|
||||
int FileUtils::indexOfQmakeUnfriendly(const QString &name, int startpos)
|
||||
{
|
||||
static QRegExp checkRegExp(QLatin1String("[^a-zA-Z0-9_.-]"));
|
||||
return checkRegExp.indexIn(name, startpos);
|
||||
static const QRegularExpression checkRegExp(QLatin1String("[^a-zA-Z0-9_.-]"));
|
||||
return checkRegExp.match(name, startpos).capturedStart();
|
||||
}
|
||||
|
||||
QString FileUtils::qmakeFriendlyName(const QString &name)
|
||||
|
||||
Reference in New Issue
Block a user