summaryrefslogtreecommitdiff
path: root/src/app/qbs/qbstool.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2013-03-07 17:35:58 +0100
committerChristian Kandeler <christian.kandeler@digia.com>2013-03-08 13:50:00 +0100
commitd2274cab50c586b85e1e03634a185edd08442171 (patch)
tree7e7ab831b508093073670ee464f8f10949e33f3b /src/app/qbs/qbstool.cpp
parent48ab7628d51c981c2396fbeb9d13852d160eb55e (diff)
downloadqbs-d2274cab50c586b85e1e03634a185edd08442171.tar.gz
Fix "qbs help" output on Windows.
Bogus tools were being displayed because we did not restrict the file name pattern enough. Task-number: QBS-216 Change-Id: I2977f9bba80fdd1b2f74acd17cc2c5bf731ffeb5 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/app/qbs/qbstool.cpp')
-rw-r--r--src/app/qbs/qbstool.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/app/qbs/qbstool.cpp b/src/app/qbs/qbstool.cpp
index 3ed7e4950..ff30b3372 100644
--- a/src/app/qbs/qbstool.cpp
+++ b/src/app/qbs/qbstool.cpp
@@ -28,6 +28,8 @@
****************************************************************************/
#include "qbstool.h"
+#include <tools/hostosinfo.h>
+
#include <QCoreApplication>
#include <QDir>
#include <QProcess>
@@ -39,7 +41,8 @@ static QString qbsBinDir() { return QCoreApplication::applicationDirPath(); }
static QString qbsToolFilePath(const QString &toolName)
{
- return qbsBinDir() + QLatin1Char('/') + toolPrefix() + toolName;
+ return qbsBinDir() + QLatin1Char('/') + toolPrefix()
+ + qbs::Internal::HostOsInfo::appendExecutableSuffix(toolName);
}
void QbsTool::runTool(const QString &toolName, const QStringList &arguments)
@@ -71,11 +74,14 @@ bool QbsTool::tryToRunTool(const QString &toolName, const QStringList &arguments
QStringList QbsTool::allToolNames()
{
+ const QString suffix = QLatin1String(QTC_HOST_EXE_SUFFIX);
QStringList toolFileNames = QDir(qbsBinDir()).entryList(QStringList(toolPrefix()
- + QLatin1Char('*')), QDir::Files, QDir::Name);
+ + QString::fromLocal8Bit("*%1").arg(suffix)), QDir::Files, QDir::Name);
QStringList toolNames;
const int prefixLength = toolPrefix().count();
- foreach (const QString &toolFileName, toolFileNames)
- toolNames << toolFileName.mid(prefixLength);
+ foreach (const QString &toolFileName, toolFileNames) {
+ toolNames << toolFileName.mid(prefixLength,
+ toolFileName.count() - prefixLength - suffix.count());
+ }
return toolNames;
}