GccToolChainFactory: Handle .exe suffix in detectForImport()

Allow detection of gcc compilers with .exe suffix.

Change-Id: I15e1050e872be0bac8934ecd4aa81914644948b5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Alessandro Portale
2019-09-23 19:57:19 +02:00
parent a82b40e037
commit a38adc0056

View File

@@ -996,7 +996,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetect(const QList<ToolChain *> &alr
QList<ToolChain *> GccToolChainFactory::detectForImport(const ToolChainDescription &tcd) QList<ToolChain *> GccToolChainFactory::detectForImport(const ToolChainDescription &tcd)
{ {
const QString fileName = tcd.compilerPath.toString(); const QString fileName = tcd.compilerPath.toFileInfo().completeBaseName();
if ((tcd.language == Constants::C_LANGUAGE_ID && (fileName.startsWith("gcc") if ((tcd.language == Constants::C_LANGUAGE_ID && (fileName.startsWith("gcc")
|| fileName.endsWith("gcc"))) || fileName.endsWith("gcc")))
|| (tcd.language == Constants::CXX_LANGUAGE_ID && (fileName.startsWith("g++") || (tcd.language == Constants::CXX_LANGUAGE_ID && (fileName.startsWith("g++")
@@ -1764,7 +1764,7 @@ QList<ToolChain *> MingwToolChainFactory::autoDetect(const QList<ToolChain *> &a
QList<ToolChain *> MingwToolChainFactory::detectForImport(const ToolChainDescription &tcd) QList<ToolChain *> MingwToolChainFactory::detectForImport(const ToolChainDescription &tcd)
{ {
const QString fileName = tcd.compilerPath.toString(); const QString fileName = tcd.compilerPath.toFileInfo().completeBaseName();
if ((tcd.language == Constants::C_LANGUAGE_ID && (fileName.startsWith("gcc") if ((tcd.language == Constants::C_LANGUAGE_ID && (fileName.startsWith("gcc")
|| fileName.endsWith("gcc"))) || fileName.endsWith("gcc")))
|| (tcd.language == Constants::CXX_LANGUAGE_ID && (fileName.startsWith("g++") || (tcd.language == Constants::CXX_LANGUAGE_ID && (fileName.startsWith("g++")