forked from qt-creator/qt-creator
QMake parsing: Improve behavior in case of empty build directory
The build directory can be "empty" if there is no build configuration, or if the build configuration's build directory is empty. Handle both cases in the same way. This avoids passing an actually empty build directory to the parser, which the parser does no longer handles gracefully on Windows. If the build directory is empty, use the project's source path (instead of QDir(QString()) which is the current working directory), which makes it consistent with the behavior when actually building in that case. The parser does not actually write files to disk, so there is no issue with temporarily using that directory and later switching to a shadow build directory. Task-number: QTCREATORBUG-20121 Change-Id: Ia454085edae6b55b445cc5cf0ec3ae1c85464b0c Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Tobias Hunger
parent
2ba326cd04
commit
9bbb085718
@@ -45,6 +45,7 @@
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
#include <utils/QtConcurrentTools>
|
||||
|
||||
#include <QLoggingCategory>
|
||||
@@ -1870,9 +1871,11 @@ FileName QmakeProFile::buildDir(QmakeBuildConfiguration *bc) const
|
||||
const QString relativeDir = srcDirRoot.relativeFilePath(directoryPath().toString());
|
||||
if (!bc && m_project->activeTarget())
|
||||
bc = static_cast<QmakeBuildConfiguration *>(m_project->activeTarget()->activeBuildConfiguration());
|
||||
if (!bc)
|
||||
return { };
|
||||
return FileName::fromString(QDir::cleanPath(QDir(bc->buildDirectory().toString()).absoluteFilePath(relativeDir)));
|
||||
const QString buildConfigBuildDir = bc ? bc->buildDirectory().toString() : QString();
|
||||
const QString buildDir = buildConfigBuildDir.isEmpty()
|
||||
? m_project->projectDirectory().toString()
|
||||
: buildConfigBuildDir;
|
||||
return FileName::fromString(QDir::cleanPath(QDir(buildDir).absoluteFilePath(relativeDir)));
|
||||
}
|
||||
|
||||
FileNameList QmakeProFile::generatedFiles(const FileName &buildDir,
|
||||
|
Reference in New Issue
Block a user