forked from qt-creator/qt-creator
McuSupport: More robust search for installations in "ProgramFiles"
Search in 32-bit and 64-bit locations. Change-Id: If267da24fa68e6d1b30e4ef6eb29b374e42693dc Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -261,6 +261,19 @@ void McuTarget::setColorDepth(int colorDepth)
|
|||||||
m_colorDepth = colorDepth;
|
m_colorDepth = colorDepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString findInProgramFiles(const QString &folder)
|
||||||
|
{
|
||||||
|
for (auto envVar : {"ProgramFiles", "ProgramFiles(x86)", "ProgramW6432"}) {
|
||||||
|
if (!qEnvironmentVariableIsSet(envVar))
|
||||||
|
continue;
|
||||||
|
const Utils::FilePath dir =
|
||||||
|
Utils::FilePath::fromUserInput(qEnvironmentVariable(envVar) + "/" + folder);
|
||||||
|
if (dir.exists())
|
||||||
|
return dir.toString();
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
static McuPackage *createQtForMCUsPackage()
|
static McuPackage *createQtForMCUsPackage()
|
||||||
{
|
{
|
||||||
auto result = new McuPackage(
|
auto result = new McuPackage(
|
||||||
@@ -280,8 +293,7 @@ static McuPackage *createArmGccPackage()
|
|||||||
if (qEnvironmentVariableIsSet(envVar))
|
if (qEnvironmentVariableIsSet(envVar))
|
||||||
defaultPath = qEnvironmentVariable(envVar);
|
defaultPath = qEnvironmentVariable(envVar);
|
||||||
if (defaultPath.isEmpty() && Utils::HostOsInfo::isWindowsHost()) {
|
if (defaultPath.isEmpty() && Utils::HostOsInfo::isWindowsHost()) {
|
||||||
const QDir installDir(
|
const QDir installDir(findInProgramFiles("/GNU Tools ARM Embedded/"));
|
||||||
qEnvironmentVariable("ProgramFiles(x86)") + "/GNU Tools ARM Embedded/");
|
|
||||||
if (installDir.exists()) {
|
if (installDir.exists()) {
|
||||||
// If GNU Tools installation dir has only one sub dir,
|
// If GNU Tools installation dir has only one sub dir,
|
||||||
// select the sub dir, otherwise the installation dir.
|
// select the sub dir, otherwise the installation dir.
|
||||||
@@ -320,11 +332,14 @@ static McuPackage *createStm32CubeFwF7SdkPackage()
|
|||||||
|
|
||||||
static McuPackage *createStm32CubeProgrammerPackage()
|
static McuPackage *createStm32CubeProgrammerPackage()
|
||||||
{
|
{
|
||||||
const QString defaultPath =
|
|
||||||
Utils::HostOsInfo::isWindowsHost() ?
|
QString defaultPath = QDir::homePath();
|
||||||
QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles"))
|
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||||
+ "/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
|
const QString programPath =
|
||||||
: QDir::homePath();
|
findInProgramFiles("/STMicroelectronics/STM32Cube/STM32CubeProgrammer/");
|
||||||
|
if (!programPath.isEmpty())
|
||||||
|
defaultPath = programPath;
|
||||||
|
}
|
||||||
auto result = new McuPackage(
|
auto result = new McuPackage(
|
||||||
McuPackage::tr("STM32CubeProgrammer"),
|
McuPackage::tr("STM32CubeProgrammer"),
|
||||||
defaultPath,
|
defaultPath,
|
||||||
@@ -351,11 +366,12 @@ static McuPackage *createEvkbImxrt1050SdkPackage()
|
|||||||
|
|
||||||
static McuPackage *createSeggerJLinkPackage()
|
static McuPackage *createSeggerJLinkPackage()
|
||||||
{
|
{
|
||||||
const QString defaultPath =
|
QString defaultPath = QString("%{Env:SEGGER_JLINK_SOFTWARE_AND_DOCUMENTATION_PATH}");
|
||||||
Utils::HostOsInfo::isWindowsHost() ?
|
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||||
QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles(x86)"))
|
const QString programPath = findInProgramFiles("/SEGGER/JLink");
|
||||||
+ "/SEGGER/JLink"
|
if (!programPath.isEmpty())
|
||||||
: QString("%{Env:SEGGER_JLINK_SOFTWARE_AND_DOCUMENTATION_PATH}");
|
defaultPath = programPath;
|
||||||
|
}
|
||||||
auto result = new McuPackage(
|
auto result = new McuPackage(
|
||||||
McuPackage::tr("SEGGER JLink"),
|
McuPackage::tr("SEGGER JLink"),
|
||||||
defaultPath,
|
defaultPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user