normalize the output of $$find()

follow suit with qt5 qmake. this is actually wrong for qt4 qmake, but i
boldly assume that it doesn't matter.

Change-Id: I7e0ced1f335fde28f56fa6c5a4a1a581ec7e9ad0
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Oswald Buddenhagen
2012-07-25 19:31:11 +02:00
parent 780c0eac10
commit 397cfb700b
3 changed files with 4 additions and 21 deletions

View File

@@ -554,14 +554,15 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
if (args.count() == 2) if (args.count() == 2)
recursive = isTrue(args.at(1), m_tmp2); recursive = isTrue(args.at(1), m_tmp2);
QStringList dirs; QStringList dirs;
QString r = fixPathToLocalOS(args.at(0).toQString(m_tmp1)); QString r = m_option->expandEnvVars(args.at(0).toQString(m_tmp1))
.replace(QLatin1Char('\\'), QLatin1Char('/'));
QString pfx; QString pfx;
if (IoUtils::isRelativePath(r)) { if (IoUtils::isRelativePath(r)) {
pfx = currentDirectory(); pfx = currentDirectory();
if (!pfx.endsWith(QLatin1Char('/'))) if (!pfx.endsWith(QLatin1Char('/')))
pfx += QLatin1Char('/'); pfx += QLatin1Char('/');
} }
int slash = r.lastIndexOf(QDir::separator()); int slash = r.lastIndexOf(QLatin1Char('/'));
if (slash != -1) { if (slash != -1) {
dirs.append(r.left(slash+1)); dirs.append(r.left(slash+1));
r = r.mid(slash+1); r = r.mid(slash+1);
@@ -580,7 +581,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
QString fname = dir + qdir[i]; QString fname = dir + qdir[i];
if (IoUtils::fileType(pfx + fname) == IoUtils::FileIsDir) { if (IoUtils::fileType(pfx + fname) == IoUtils::FileIsDir) {
if (recursive) if (recursive)
dirs.append(fname + QDir::separator()); dirs.append(fname + QLatin1Char('/'));
} }
if (regex.exactMatch(qdir[i])) if (regex.exactMatch(qdir[i]))
ret += ProString(fname, NoHash).setSource(currentProFile()); ret += ProString(fname, NoHash).setSource(currentProFile());

View File

@@ -340,22 +340,6 @@ static void replaceInList(ProStringList *varlist,
} }
} }
// This is braindead, but we want qmake compat
QString QMakeEvaluator::fixPathToLocalOS(const QString &str) const
{
QString string = m_option->expandEnvVars(str);
if (string.length() > 2 && string.at(0).isLetter() && string.at(1) == QLatin1Char(':'))
string[0] = string[0].toLower();
#if defined(Q_OS_WIN32)
string.replace(QLatin1Char('/'), QLatin1Char('\\'));
#else
string.replace(QLatin1Char('\\'), QLatin1Char('/'));
#endif
return string;
}
//////// Evaluator ///////// //////// Evaluator /////////
static ALWAYS_INLINE void addStr( static ALWAYS_INLINE void addStr(

View File

@@ -180,8 +180,6 @@ public:
QHash<ProString, QSet<ProString> > &dependencies, QHash<ProString, QSet<ProString> > &dependencies,
ProValueMap &dependees, ProStringList &rootSet) const; ProValueMap &dependees, ProStringList &rootSet) const;
QString fixPathToLocalOS(const QString &str) const;
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
void runProcess(QProcess *proc, const QString &command, QProcess::ProcessChannel chan) const; void runProcess(QProcess *proc, const QString &command, QProcess::ProcessChannel chan) const;
#endif #endif