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:
Thorbjørn Lindeijer
2010-03-15 16:15:36 +01:00
parent 7215c03369
commit c0b42868b0
4 changed files with 18 additions and 10 deletions

View File

@@ -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)

View File

@@ -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:

View File

@@ -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)