diff --git a/src/plugins/baremetal/iarewtoolchain.cpp b/src/plugins/baremetal/iarewtoolchain.cpp index 9a2d13c95ea..0804aa61363 100644 --- a/src/plugins/baremetal/iarewtoolchain.cpp +++ b/src/plugins/baremetal/iarewtoolchain.cpp @@ -34,14 +34,6 @@ using namespace Utils; namespace BareMetal::Internal { -// Helpers: - -static bool compilerExists(const FilePath &compilerPath) -{ - const QFileInfo fi = compilerPath.toFileInfo(); - return fi.exists() && fi.isExecutable() && fi.isFile(); -} - static QString cppLanguageOption(const FilePath &compiler) { const QString baseName = compiler.baseName(); @@ -485,7 +477,7 @@ Toolchains IarToolChainFactory::autoDetect(const ToolchainDetector &detector) co // Build full compiler path. compilerPath += entry.subExePath; const FilePath fn = FilePath::fromUserInput(compilerPath); - if (compilerExists(fn)) { + if (fn.isExecutableFile()) { // Note: threeLevelKey is a guessed toolchain version. candidates.push_back({fn, threeLevelKey}); } @@ -634,14 +626,14 @@ void IarToolChainConfigWidget::setFromToolchain() m_compilerCommand->setFilePath(tc->compilerCommand()); m_platformCodeGenFlagsLineEdit->setText(ProcessArgs::joinArgs(tc->extraCodeModelFlags())); m_abiWidget->setAbis({}, tc->targetAbi()); - const bool haveCompiler = compilerExists(m_compilerCommand->filePath()); + const bool haveCompiler = m_compilerCommand->filePath().isExecutableFile(); m_abiWidget->setEnabled(haveCompiler && !tc->isAutoDetected()); } void IarToolChainConfigWidget::handleCompilerCommandChange() { const FilePath compilerPath = m_compilerCommand->filePath(); - const bool haveCompiler = compilerExists(compilerPath); + const bool haveCompiler = compilerPath.isExecutableFile(); if (haveCompiler) { const auto env = Environment::systemEnvironment(); const QStringList extraArgs = splitString(m_platformCodeGenFlagsLineEdit->text()); diff --git a/src/plugins/baremetal/keiltoolchain.cpp b/src/plugins/baremetal/keiltoolchain.cpp index 552bc3c35f3..d39dc9f03b0 100644 --- a/src/plugins/baremetal/keiltoolchain.cpp +++ b/src/plugins/baremetal/keiltoolchain.cpp @@ -36,14 +36,6 @@ using namespace Utils; namespace BareMetal::Internal { -// Helpers: - -static bool compilerExists(const FilePath &compilerPath) -{ - const QFileInfo fi = compilerPath.toFileInfo(); - return fi.exists() && fi.isExecutable() && fi.isFile(); -} - static Abi::Architecture guessArchitecture(const FilePath &compilerPath) { const QFileInfo fi = compilerPath.toFileInfo(); @@ -785,14 +777,14 @@ void KeilToolChainConfigWidget::setFromToolChain() m_compilerCommand->setFilePath(tc->compilerCommand()); m_platformCodeGenFlagsLineEdit->setText(ProcessArgs::joinArgs(tc->extraCodeModelFlags())); m_abiWidget->setAbis({}, tc->targetAbi()); - const bool haveCompiler = compilerExists(m_compilerCommand->filePath()); + const bool haveCompiler = m_compilerCommand->filePath().isExecutableFile(); m_abiWidget->setEnabled(haveCompiler && !tc->isAutoDetected()); } void KeilToolChainConfigWidget::handleCompilerCommandChange() { const FilePath compilerPath = m_compilerCommand->filePath(); - const bool haveCompiler = compilerExists(compilerPath); + const bool haveCompiler = compilerPath.isExecutableFile(); if (haveCompiler) { const auto env = Environment::systemEnvironment(); const QStringList prevExtraArgs = splitString(m_platformCodeGenFlagsLineEdit->text()); diff --git a/src/plugins/baremetal/sdcctoolchain.cpp b/src/plugins/baremetal/sdcctoolchain.cpp index f559aac3a65..48a2257ec6b 100644 --- a/src/plugins/baremetal/sdcctoolchain.cpp +++ b/src/plugins/baremetal/sdcctoolchain.cpp @@ -35,14 +35,6 @@ using namespace Utils; namespace BareMetal::Internal { -// Helpers: - -static bool compilerExists(const FilePath &compilerPath) -{ - const QFileInfo fi = compilerPath.toFileInfo(); - return fi.exists() && fi.isExecutable() && fi.isFile(); -} - static QString compilerTargetFlag(const Abi &abi) { switch (abi.architecture()) { @@ -346,7 +338,7 @@ Toolchains SdccToolChainFactory::autoDetect(const ToolchainDetector &detector) c compilerPath += "/bin/sdcc.exe"; const FilePath fn = FilePath::fromString( QFileInfo(compilerPath).absoluteFilePath()); - if (!compilerExists(fn)) + if (!fn.isExecutableFile()) return Candidate{}; // Build compiler version. const QString version = QString("%1.%2.%3").arg( @@ -511,14 +503,14 @@ void SdccToolChainConfigWidget::setFromToolchain() const auto tc = static_cast(toolChain()); m_compilerCommand->setFilePath(tc->compilerCommand()); m_abiWidget->setAbis({}, tc->targetAbi()); - const bool haveCompiler = compilerExists(m_compilerCommand->filePath()); + const bool haveCompiler = m_compilerCommand->filePath().isExecutableFile(); m_abiWidget->setEnabled(haveCompiler && !tc->isAutoDetected()); } void SdccToolChainConfigWidget::handleCompilerCommandChange() { const FilePath compilerPath = m_compilerCommand->filePath(); - const bool haveCompiler = compilerExists(compilerPath); + const bool haveCompiler = compilerPath.isExecutableFile(); if (haveCompiler) { const auto env = Environment::systemEnvironment(); m_macros = dumpPredefinedMacros(compilerPath, env, {});