add $$native_path() function
more or less QDir::toNativeSeparators(QDir::cleanPath()) Change-Id: I52deee1e8086559eda5833b387a0cf64d21cbcd9 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
This commit is contained in:
parent
f97913f2da
commit
d8e6c49bfa
@ -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_CLEAN_PATH };
|
||||
E_SHADOWED, E_CLEAN_PATH, E_NATIVE_PATH };
|
||||
QHash<QString, ExpandFunc> qmake_expandFunctions()
|
||||
{
|
||||
static QHash<QString, ExpandFunc> *qmake_expand_functions = 0;
|
||||
@ -121,6 +121,7 @@ QHash<QString, ExpandFunc> qmake_expandFunctions()
|
||||
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);
|
||||
qmake_expand_functions->insert("native_path", E_NATIVE_PATH);
|
||||
}
|
||||
return *qmake_expand_functions;
|
||||
}
|
||||
@ -2584,6 +2585,13 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
|
||||
else
|
||||
ret += QDir::cleanPath(args.at(0));
|
||||
break;
|
||||
case E_NATIVE_PATH:
|
||||
if (args.count() != 1)
|
||||
fprintf(stderr, "%s:%d native_path(path) requires one argument.\n",
|
||||
parser.file.toLatin1().constData(), parser.line_no);
|
||||
else
|
||||
ret += Option::fixPathToTargetOS(args.at(0), false);
|
||||
break;
|
||||
default: {
|
||||
fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
|
||||
parser.file.toLatin1().constData(), parser.line_no,
|
||||
|
@ -129,3 +129,5 @@ testReplace($$format_number(13, width=5 padsign), " $$spc 13", "sign-padded numb
|
||||
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")
|
||||
|
||||
testReplace($$native_path("/crazy/trolls"), "$${DIR_SEPARATOR}crazy$${DIR_SEPARATOR}trolls", "native_path")
|
||||
|
Loading…
Reference in New Issue
Block a user