forked from qt-creator/qt-creator
McuSupport: Detect GNU Toolchain for Arm a bit better
If there is exactly one subdir in the GNU Tools installation dir, pre- select it. Change-Id: I14cb2e46863884724d4eef2ecac83513c515ebee Reviewed-by: Aurindam Jana <aurindam.jana@qt.io>
This commit is contained in:
committed by
Aurindam Jana
parent
67ba6a5b9a
commit
43e40f21a7
@@ -234,11 +234,26 @@ static PackageOptions *createQulPackage()
|
|||||||
|
|
||||||
static PackageOptions *createArmGccPackage()
|
static PackageOptions *createArmGccPackage()
|
||||||
{
|
{
|
||||||
const QString defaultPath =
|
const char envVar[] = "ARMGCC_DIR";
|
||||||
Utils::HostOsInfo::isWindowsHost() ?
|
|
||||||
QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles(x86)"))
|
QString defaultPath;
|
||||||
+ "/GNU Tools ARM Embedded/"
|
if (qEnvironmentVariableIsSet(envVar))
|
||||||
: QString("%{Env:ARMGCC_DIR}");
|
defaultPath = qEnvironmentVariable(envVar);
|
||||||
|
if (defaultPath.isEmpty() && Utils::HostOsInfo::isWindowsHost()) {
|
||||||
|
const QDir installDir(
|
||||||
|
qEnvironmentVariable("ProgramFiles(x86)") + "/GNU Tools ARM Embedded/");
|
||||||
|
if (installDir.exists()) {
|
||||||
|
// If GNU Tools installation dir has only one sub dir,
|
||||||
|
// select the sub dir, otherwise the installation dir.
|
||||||
|
const QFileInfoList subDirs =
|
||||||
|
installDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
if (subDirs.count() == 1)
|
||||||
|
defaultPath = subDirs.first().filePath() + '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (defaultPath.isEmpty())
|
||||||
|
defaultPath = QDir::homePath();
|
||||||
|
|
||||||
auto result = new PackageOptions(
|
auto result = new PackageOptions(
|
||||||
PackageOptions::tr("GNU Arm Embedded Toolchain"),
|
PackageOptions::tr("GNU Arm Embedded Toolchain"),
|
||||||
defaultPath,
|
defaultPath,
|
||||||
@@ -246,7 +261,7 @@ static PackageOptions *createArmGccPackage()
|
|||||||
Constants::SETTINGS_KEY_PACKAGE_ARMGCC);
|
Constants::SETTINGS_KEY_PACKAGE_ARMGCC);
|
||||||
result->setDownloadUrl(
|
result->setDownloadUrl(
|
||||||
"https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads");
|
"https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads");
|
||||||
result->setEnvironmentVariableName("ARMGCC_DIR");
|
result->setEnvironmentVariableName(envVar);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user