diff options
| author | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-04-09 18:05:13 +0200 |
|---|---|---|
| committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-04-10 14:34:34 +0200 |
| commit | b407803b34da8b57bbb9a1cf034344e6bee11d45 (patch) | |
| tree | 769acc809703108e9298f263aabdb784c614a4b5 | |
| parent | 34f213e3702a914d0de671937a755ade978f554b (diff) | |
| download | qbs-b407803b34da8b57bbb9a1cf034344e6bee11d45.tar.gz | |
fix relative install root paths
The install root must be passed to the library as an absolute path. A
QBS_ASSERT makes sure that we notice wrong usage. The command line
frontend converts a relative install root path to an absolute path.
Task-number: QBS-250
Change-Id: I4695dc29fdc5ead3af9a632b420b399f26c40166
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
| -rw-r--r-- | src/app/qbs/parser/commandlineparser.cpp | 5 | ||||
| -rw-r--r-- | src/lib/buildgraph/productinstaller.cpp | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/app/qbs/parser/commandlineparser.cpp b/src/app/qbs/parser/commandlineparser.cpp index 0ac6210ec..1b8a657c6 100644 --- a/src/app/qbs/parser/commandlineparser.cpp +++ b/src/app/qbs/parser/commandlineparser.cpp @@ -152,6 +152,11 @@ InstallOptions CommandLineParser::installOptions() const InstallOptions options; options.removeFirst = d->optionPool.removeFirstoption()->enabled(); options.installRoot = d->optionPool.installRootOption()->installRoot(); + if (!options.installRoot.isEmpty()) { + QFileInfo fi(options.installRoot); + if (!fi.isAbsolute()) + options.installRoot = fi.absoluteFilePath(); + } options.dryRun = buildOptions().dryRun; options.keepGoing = buildOptions().keepGoing; options.logElapsedTime = logTime(); diff --git a/src/lib/buildgraph/productinstaller.cpp b/src/lib/buildgraph/productinstaller.cpp index b5ff5518a..e66d2c69e 100644 --- a/src/lib/buildgraph/productinstaller.cpp +++ b/src/lib/buildgraph/productinstaller.cpp @@ -34,6 +34,7 @@ #include "rulesevaluationcontext.h" #include <language/language.h> #include <logging/translator.h> +#include <tools/qbsassert.h> #include <tools/error.h> #include <tools/fileinfo.h> #include <tools/progressobserver.h> @@ -49,8 +50,10 @@ ProductInstaller::ProductInstaller(const QList<BuildProductPtr> &products, : m_products(products), m_options(options), m_observer(observer), m_logger(logger) { if (!m_options.installRoot.isEmpty()) { + QFileInfo installRootFileInfo(m_options.installRoot); + QBS_ASSERT(installRootFileInfo.isAbsolute(), /* just complain */); if (m_options.removeFirst) { - const QString cfp = QFileInfo(m_options.installRoot).canonicalFilePath(); + const QString cfp = installRootFileInfo.canonicalFilePath(); if (cfp == QFileInfo(QDir::rootPath()).canonicalFilePath()) throw Error(Tr::tr("Refusing to remove root directory.")); if (cfp == QFileInfo(QDir::homePath()).canonicalFilePath()) |
