make $$relative_path() minimize already relative paths

QDir::relativeFilePath() doesn't do anything if the path is already
relative, so make it absolute first to force a re-calculation.

the cleanPath() is gone, as relativeFilePath() already does that.

Change-Id: I8f4d0d839db3fe99a608f70916b4b5bd52c56535
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-08-06 20:44:10 +02:00 committed by Qt by Nokia
parent 6e4ed714f1
commit 68cbeb59d9

View File

@ -2727,12 +2727,13 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
.absoluteFilePath(args.at(0)));
break;
case E_RELATIVE_PATH:
if (args.count() > 2)
if (args.count() > 2) {
fprintf(stderr, "%s:%d relative_path(path[, base]) requires one or two arguments.\n",
parser.file.toLatin1().constData(), parser.line_no);
else
ret += QDir::cleanPath(QDir(args.count() > 1 ? args.at(1) : QString())
.relativeFilePath(args.at(0)));
} else {
QDir baseDir(args.count() > 1 ? args.at(1) : QString());
ret += baseDir.relativeFilePath(baseDir.absoluteFilePath(args.at(0)));
}
break;
case E_CLEAN_PATH:
if (args.count() != 1)