Commit 66131474 authored by dt's avatar dt
Browse files

Simplfy code for finding the right target/executable

Reviewed-By: con
parent e58e9f59
......@@ -427,12 +427,7 @@ void MaemoRunConfiguration::updateTarget()
return;
}
QString baseDir;
if (info.hasCustomDestDir)
baseDir = info.workingDir;
else
baseDir = info.baseDestDir;
m_executable = QDir::cleanPath(baseDir + QLatin1Char('/') + info.target);
m_executable = QDir::cleanPath(info.workingDir + QLatin1Char('/') + info.target);
emit targetInformationChanged();
}
......
......@@ -295,14 +295,10 @@ void S60DeviceRunConfiguration::updateTarget()
emit targetInformationChanged();
return;
}
QString workingDir;
if (info.hasCustomDestDir)
workingDir = info.workingDir;
else
workingDir = info.baseDestDir;
m_targetName = info.target;
m_baseFileName = workingDir + QLatin1Char('/') + m_targetName;
m_baseFileName = info.workingDir + QLatin1Char('/') + m_targetName;
m_packageTemplateFileName = m_baseFileName + QLatin1String("_template.pkg");
Qt4BuildConfiguration *qt4bc = qt4Project()->activeQt4BuildConfiguration();
......
......@@ -838,12 +838,10 @@ Qt4TargetInformation Qt4Project::targetInformation(Qt4BuildConfiguration *buildC
const QString relSubDir = baseProjectDirectory.relativeFilePath(QFileInfo(proFilePath).path());
const QDir baseBuildDirectory = buildConfiguration->buildDirectory();
const QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir);
info.baseDestDir = QDir::cleanPath(baseDir);
//qDebug()<<relSubDir<<baseDir;
// Working Directory
if (reader->contains("DESTDIR")) {
info.hasCustomDestDir = true;
//qDebug() << "reader contains destdir:" << reader->value("DESTDIR");
info.workingDir = reader->value("DESTDIR");
if (QDir::isRelativePath(info.workingDir)) {
......@@ -851,16 +849,8 @@ Qt4TargetInformation Qt4Project::targetInformation(Qt4BuildConfiguration *buildC
//qDebug() << "was relative and expanded to" << info.workingDir;
}
} else {
info.hasCustomDestDir = false;
//qDebug() << "reader didn't contain DESTDIR, setting to " << baseDir;
info.workingDir = baseDir;
if (reader->values("CONFIG").contains("debug_and_release_target")) {
//qDebug() << "reader has debug_and_release_target";
QString qmakeBuildConfig = "release";
if (buildConfiguration->qmakeBuildConfiguration() & QtVersion::DebugBuild)
qmakeBuildConfig = "debug";
info.workingDir += QLatin1Char('/') + qmakeBuildConfig;
}
}
info.target = reader->value("TARGET");
......@@ -876,7 +866,21 @@ Qt4TargetInformation Qt4Project::targetInformation(Qt4BuildConfiguration *buildC
#endif
info.workingDir = QDir::cleanPath(info.workingDir);
info.executable = QDir::cleanPath(info.workingDir + QLatin1Char('/') + info.target);
QString wd = info.workingDir;
if (!reader->contains("DESTDIR")
&& reader->values("CONFIG").contains("debug_and_release")
&& reader->values("CONFIG").contains("debug_and_release_target")) {
// If we don't have a destdir and debug and release is set
// then the executable is in a debug/release folder
//qDebug() << "reader has debug_and_release_target";
QString qmakeBuildConfig = "release";
if (buildConfiguration->qmakeBuildConfiguration() & QtVersion::DebugBuild)
qmakeBuildConfig = "debug";
wd += QLatin1Char('/') + qmakeBuildConfig;
}
info.executable = QDir::cleanPath(wd + QLatin1Char('/') + info.target);
//qDebug() << "##### updateTarget sets:" << info.workingDir << info.executable;
#if defined (Q_OS_WIN)
......
......@@ -127,8 +127,6 @@ struct Qt4TargetInformation
};
ErrorCode error;
bool hasCustomDestDir;
QString baseDestDir;
QString workingDir;
QString target;
QString executable;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment