add $$clean_path() function

just QDir::cleanPath()

Change-Id: I2d51e2385939d8926c00f296537ab7f6757d9a79
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-04-20 15:37:25 +02:00
parent 1261c9b2f4
commit f97913f2da
2 changed files with 11 additions and 1 deletions

View File

@ -82,7 +82,7 @@ enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST
E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND,
E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_VAL_ESCAPE, E_REPLACE,
E_SIZE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS,
E_SHADOWED };
E_SHADOWED, E_CLEAN_PATH };
QHash<QString, ExpandFunc> qmake_expandFunctions()
{
static QHash<QString, ExpandFunc> *qmake_expand_functions = 0;
@ -120,6 +120,7 @@ QHash<QString, ExpandFunc> qmake_expandFunctions()
qmake_expand_functions->insert("resolve_depends", E_RESOLVE_DEPENDS);
qmake_expand_functions->insert("enumerate_vars", E_ENUMERATE_VARS);
qmake_expand_functions->insert("shadowed", E_SHADOWED);
qmake_expand_functions->insert("clean_path", E_CLEAN_PATH);
}
return *qmake_expand_functions;
}
@ -2576,6 +2577,13 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
else if (val.startsWith(Option::mkfile::source_root))
ret += Option::mkfile::build_root + val.mid(Option::mkfile::source_root.length());
break; }
case E_CLEAN_PATH:
if (args.count() != 1)
fprintf(stderr, "%s:%d clean_path(path) requires one argument.\n",
parser.file.toLatin1().constData(), parser.line_no);
else
ret += QDir::cleanPath(args.at(0));
break;
default: {
fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
parser.file.toLatin1().constData(), parser.line_no,

View File

@ -127,3 +127,5 @@ testReplace($$format_number(13, width=5 alwayssign), "$$spc +13", "always signed
testReplace($$format_number(13, width=5 alwayssign zeropad), "+0013", "zero-padded always signed number format")
testReplace($$format_number(13, width=5 padsign), " $$spc 13", "sign-padded number format")
testReplace($$format_number(13, width=5 padsign zeropad), " 0013", "zero-padded sign-padded number format")
testReplace($$clean_path("c:$${DIR_SEPARATOR}crazy//path/../trolls"), "c:/crazy/trolls", "clean_path")