fix $$shell_path() for mingw+sh

the msys shell expects unix-like paths with drives converted
from d:\ to /d/.

Change-Id: I09e25ed2c868702e5d7d8b9cc8c04cc13410eeff
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Oswald Buddenhagen 2014-04-29 20:39:13 +02:00 committed by The Qt Project
parent f73b9e4af8
commit d52b00e1d3

View File

@ -1064,10 +1064,18 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
evalError(fL1S("shell_path(path) requires one argument."));
} else {
QString rstr = args.at(0).toQString(m_tmp1);
if (m_dirSep.startsWith(QLatin1Char('\\')))
if (m_dirSep.startsWith(QLatin1Char('\\'))) {
rstr.replace(QLatin1Char('/'), QLatin1Char('\\'));
else
} else {
rstr.replace(QLatin1Char('\\'), QLatin1Char('/'));
#ifdef Q_OS_WIN
// Convert d:/foo/bar to msys-style /d/foo/bar.
if (rstr.length() > 2 && rstr.at(1) == QLatin1Char(':') && rstr.at(2) == QLatin1Char('/')) {
rstr[1] = rstr.at(0);
rstr[0] = QLatin1Char('/');
}
#endif
}
ret << (rstr.isSharedWith(m_tmp1) ? args.at(0) : ProString(rstr).setSource(args.at(0)));
}
break;