diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-07-25 19:17:23 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-08-01 16:42:50 +0200 |
commit | 58a431fac98abdcadaa87627a989a4379a1d7879 (patch) | |
tree | a44b0fc3b72a1db181e4c951f0ff0e30f848204a /src | |
parent | 187751f9678d9bc45aa26c435997639178cf4c6b (diff) | |
download | qt-creator-58a431fac98abdcadaa87627a989a4379a1d7879.tar.gz |
add $$absolute_path() & $$relative_path() functions
follow suit with qmake ...
Change-Id: Idbe30c40ef86286b871d678900c963b5d9d851c4
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/proparser/qmakebuiltins.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp index 630d1fb080..79a2a9c6bb 100644 --- a/src/shared/proparser/qmakebuiltins.cpp +++ b/src/shared/proparser/qmakebuiltins.cpp @@ -77,7 +77,7 @@ enum ExpandFunc { E_FIND, E_SYSTEM, E_UNIQUE, E_REVERSE, E_QUOTE, E_ESCAPE_EXPAND, E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_VAL_ESCAPE, E_REPLACE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS, - E_SHADOWED + E_SHADOWED, E_ABSOLUTE_PATH, E_RELATIVE_PATH }; enum TestFunc { @@ -125,6 +125,8 @@ void QMakeEvaluator::initFunctionStatics() { "resolve_depends", E_RESOLVE_DEPENDS }, { "enumerate_vars", E_ENUMERATE_VARS }, { "shadowed", E_SHADOWED }, + { "absolute_path", E_ABSOLUTE_PATH }, + { "relative_path", E_RELATIVE_PATH }, }; for (unsigned i = 0; i < sizeof(expandInits)/sizeof(expandInits[0]); ++i) statics.expands.insert(ProString(expandInits[i].name), expandInits[i].func); @@ -836,6 +838,22 @@ ProStringList QMakeEvaluator::evaluateExpandFunction( } } break; + case E_ABSOLUTE_PATH: + if (args.count() > 2) + evalError(fL1S("absolute_path(path[, base]) requires one or two arguments.")); + else + ret << ProString(QDir::cleanPath( + QDir(args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory()) + .absoluteFilePath(args.at(0).toQString(m_tmp1))), NoHash).setSource(args.at(0)); + break; + case E_RELATIVE_PATH: + if (args.count() > 2) + evalError(fL1S("relative_path(path[, base]) requires one or two arguments.")); + else + ret << ProString(QDir::cleanPath( + QDir(args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory()) + .relativeFilePath(args.at(0).toQString(m_tmp1))), NoHash).setSource(args.at(0)); + break; case E_INVALID: evalError(fL1S("'%1' is not a recognized replace function.") .arg(func.toQString(m_tmp1))); |