diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2018-03-02 12:30:44 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2018-03-22 08:40:45 +0000 |
commit | 58b373c9e3c0a7307e3fbafeb5ad710088b8e685 (patch) | |
tree | 77838dfc0e309c272c1209abefed4a5671ad7201 /qmake/doc/src/qmake-manual.qdoc | |
parent | ee54df0311516b07d04ada71c6c5e81827cb0b38 (diff) |
Make sure $$relative_path() uses an absolute path as its first arg
Thanks to QTBUG-61373, this qmake function was called with
/usr/local/5.10.1 as baseDir, which isn't absolute, leading to an
assertion failure. We could raise the error within qmake but it
proved easier to simply resolve any non-absolute baseDir using PWD,
before trying to use it as an absolute path.
Did the same for $$absolute_path(). Documented both. Adjusted the
assert that caught this to report any non-absolute path that upsets
it. Added simple tests, fixed an existing test.
Task-number: QTBUG-66156
Change-Id: Icfef2e2f5b236e071177c9beffa38d71bf404292
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'qmake/doc/src/qmake-manual.qdoc')
-rw-r--r-- | qmake/doc/src/qmake-manual.qdoc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index cc3b73418b..35f24e1793 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2913,7 +2913,8 @@ Returns the absolute path of \c path. If \c base is not specified, uses the current directory as the base - directory. + directory. If it is a relative path, it is resolved relative to the current + directory before use. For example, the following call returns the string \c {"/home/johndoe/myproject/readme.txt"}: @@ -3152,9 +3153,15 @@ \section2 relative_path(filePath[, base]) - Returns the path to \c filePath relative to \c base. If \c base is not - specified, it is the current project directory. This function is a wrapper - around QDir::relativeFilePath. + Returns the path to \c filePath relative to \c base. + + If \c base is not specified, it is the current project + directory. If it is relative, it is resolved relative to the + current project directory before use. + + If \c filePath is relative, it is first resolved against the base + directory; in that case, this function effectively acts as + $$clean_path(). See also \l{absolute_path(path[, base])}{absolute_path()}, \l{clean_path(path)}{clean_path()}. |