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:
parent
1261c9b2f4
commit
f97913f2da
@ -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_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_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_SIZE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS,
|
||||||
E_SHADOWED };
|
E_SHADOWED, E_CLEAN_PATH };
|
||||||
QHash<QString, ExpandFunc> qmake_expandFunctions()
|
QHash<QString, ExpandFunc> qmake_expandFunctions()
|
||||||
{
|
{
|
||||||
static QHash<QString, ExpandFunc> *qmake_expand_functions = 0;
|
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("resolve_depends", E_RESOLVE_DEPENDS);
|
||||||
qmake_expand_functions->insert("enumerate_vars", E_ENUMERATE_VARS);
|
qmake_expand_functions->insert("enumerate_vars", E_ENUMERATE_VARS);
|
||||||
qmake_expand_functions->insert("shadowed", E_SHADOWED);
|
qmake_expand_functions->insert("shadowed", E_SHADOWED);
|
||||||
|
qmake_expand_functions->insert("clean_path", E_CLEAN_PATH);
|
||||||
}
|
}
|
||||||
return *qmake_expand_functions;
|
return *qmake_expand_functions;
|
||||||
}
|
}
|
||||||
@ -2576,6 +2577,13 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
|
|||||||
else if (val.startsWith(Option::mkfile::source_root))
|
else if (val.startsWith(Option::mkfile::source_root))
|
||||||
ret += Option::mkfile::build_root + val.mid(Option::mkfile::source_root.length());
|
ret += Option::mkfile::build_root + val.mid(Option::mkfile::source_root.length());
|
||||||
break; }
|
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: {
|
default: {
|
||||||
fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
|
fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
|
||||||
parser.file.toLatin1().constData(), parser.line_no,
|
parser.file.toLatin1().constData(), parser.line_no,
|
||||||
|
@ -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 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), " $$spc 13", "sign-padded number format")
|
||||||
testReplace($$format_number(13, width=5 padsign zeropad), " 0013", "zero-padded 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")
|
||||||
|
Loading…
Reference in New Issue
Block a user