From 00a1cf03c3428a0687faca642f343df4257ffc1b Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 19 May 2017 16:05:20 +0200 Subject: When setting the build root, create the directory along the way ... if necessary. Otherwise it makes no sense trying to get the canonical file path. Change-Id: I5a9c4237a8e4081c338ace685f20debb02f848fd Reviewed-by: Jake Petroules --- src/lib/corelib/tools/setupprojectparameters.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/lib/corelib/tools/setupprojectparameters.cpp b/src/lib/corelib/tools/setupprojectparameters.cpp index 10cdca181..db7b11118 100644 --- a/src/lib/corelib/tools/setupprojectparameters.cpp +++ b/src/lib/corelib/tools/setupprojectparameters.cpp @@ -45,6 +45,7 @@ #include #include +#include #include namespace qbs { @@ -195,6 +196,11 @@ void SetupProjectParameters::setBuildRoot(const QString &buildRoot) { d->buildRoot = buildRoot; + // We don't do error checking here, as this is not a convenient place to report an error. + // If creation of the build directory is not possible, we will get sensible error messages + // later, e.g. from the code that attempts to store the build graph. + QDir::root().mkpath(buildRoot); + const QString canonicalBuildRoot = QFileInfo(d->buildRoot).canonicalFilePath(); if (!canonicalBuildRoot.isEmpty()) d->buildRoot = canonicalBuildRoot; -- cgit v1.2.3