forked from qt-creator/qt-creator
Preserve the user-set build directory for Generic Projects
Previously it would be converted to an absolute path. Preserving the original path allows it to be set as relative to the project. Reviewed-by: dt
This commit is contained in:
@@ -89,13 +89,19 @@ ProjectExplorer::Environment GenericBuildConfiguration::environment() const
|
||||
|
||||
QString GenericBuildConfiguration::buildDirectory() const
|
||||
{
|
||||
QString buildDirectory = m_buildDirectory;
|
||||
if (buildDirectory.isEmpty()) {
|
||||
QFileInfo fileInfo(target()->project()->file()->fileName());
|
||||
// Convert to absolute path when necessary
|
||||
const QFileInfo projectFile(target()->project()->file()->fileName());
|
||||
const QDir projectDir(projectFile.path());
|
||||
return projectDir.absoluteFilePath(m_buildDirectory);
|
||||
}
|
||||
|
||||
buildDirectory = fileInfo.absolutePath();
|
||||
}
|
||||
return buildDirectory;
|
||||
/**
|
||||
* Returns the build directory unmodified, instead of making it absolute like
|
||||
* buildDirectory() does.
|
||||
*/
|
||||
QString GenericBuildConfiguration::rawBuildDirectory() const
|
||||
{
|
||||
return m_buildDirectory;
|
||||
}
|
||||
|
||||
void GenericBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
|
||||
|
||||
@@ -51,7 +51,10 @@ public:
|
||||
|
||||
virtual ProjectExplorer::Environment environment() const;
|
||||
virtual QString buildDirectory() const;
|
||||
|
||||
QString rawBuildDirectory() const;
|
||||
void setBuildDirectory(const QString &buildDirectory);
|
||||
|
||||
QVariantMap toMap() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -504,7 +504,7 @@ void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
|
||||
m_nameLineEdit->setText(m_buildConfiguration->displayName());
|
||||
m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
|
||||
m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::configNameEdited(const QString &name)
|
||||
|
||||
Reference in New Issue
Block a user