forked from qt-creator/qt-creator
ProjectExplorer: Do not generate new directory when original is in-place
If the original configuration is not a shadow build, there is no reason to generate a new directory name when cloning the configuration. Change-Id: Ie84ee01ac70c69161e65a0b58cdfbfbe1a1630ab Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
b56c872b27
commit
7fc6af4ad6
@@ -27,6 +27,7 @@
|
||||
#include "buildinfo.h"
|
||||
#include "buildstepspage.h"
|
||||
#include "target.h"
|
||||
#include "project.h"
|
||||
#include "buildconfiguration.h"
|
||||
#include "projectconfigurationmodel.h"
|
||||
#include "session.h"
|
||||
@@ -300,13 +301,16 @@ void BuildSettingsWidget::cloneConfiguration()
|
||||
return;
|
||||
|
||||
bc->setDisplayName(name);
|
||||
const std::function<bool(const FilePath &)> isBuildDirOk = [this](const FilePath &candidate) {
|
||||
if (candidate.exists())
|
||||
return false;
|
||||
return !anyOf(m_target->buildConfigurations(), [&candidate](const BuildConfiguration *bc) {
|
||||
return bc->buildDirectory() == candidate; });
|
||||
};
|
||||
bc->setBuildDirectory(makeUniquelyNumbered(bc->buildDirectory(), isBuildDirOk));
|
||||
const FilePath buildDirectory = bc->buildDirectory();
|
||||
if (buildDirectory != m_target->project()->projectDirectory()) {
|
||||
const std::function<bool(const FilePath &)> isBuildDirOk = [this](const FilePath &candidate) {
|
||||
if (candidate.exists())
|
||||
return false;
|
||||
return !anyOf(m_target->buildConfigurations(), [&candidate](const BuildConfiguration *bc) {
|
||||
return bc->buildDirectory() == candidate; });
|
||||
};
|
||||
bc->setBuildDirectory(makeUniquelyNumbered(buildDirectory, isBuildDirOk));
|
||||
}
|
||||
m_target->addBuildConfiguration(bc);
|
||||
SessionManager::setActiveBuildConfiguration(m_target, bc, SetActive::Cascade);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user