9#include <QtCore/qcoreapplication.h>
10#include <QtCore/qdir.h>
11#include <QtCore/qregularexpression.h>
22 QString filePath = QLibraryInfo::path(location) + u'/' + toolName;
24 filePath.append(
".exe"_L1);
26 return QDir::cleanPath(filePath);
31 std::cerr << qUtf8Printable(out);
36 static QRegularExpression rx(QStringLiteral(
"\\s"));
38 if (result.contains(rx)) {
39 const QLatin1Char dblqt(
'"');
40 result.prepend(dblqt);
49 result.reserve(strs.size());
50 std::transform(strs.begin(), strs.end(),
std::back_inserter(result),
51 static_cast<QString (*)(
const QString &)>(&shellQuoted));
56 const QStringList &arguments)
58 return shellQuoted(program) + u' ' + shellQuoted(arguments).join(u' ');
62 QLibraryInfo::LibraryPath location)
65 const QString commandLine = commandLineForSystem(qtToolFilePath(toolName, location), arguments);
67 exitCode = _wsystem(
reinterpret_cast<
const wchar_t *>(commandLine.utf16()));
68#elif defined(Q_OS_UNIX)
69 int ret = std::system(qPrintable(commandLine));
70 exitCode = WEXITSTATUS(ret);
72 exitCode =
std::system(qPrintable(commandLine));
77void runQtTool(
const QString &toolName,
const QStringList &arguments,
78 QLibraryInfo::LibraryPath location)
80 const int exitCode = runQtToolHelper(toolName, arguments, location);
87 return runQtToolHelper(toolName, arguments, QLibraryInfo::LibraryExecutablesPath);
92 const int exitCode = runInternalQtToolHelper(toolName, arguments);
99 std::unique_ptr<QTemporaryFile> file(
new QTemporaryFile(QStringLiteral(
"XXXXXX.json")));
101 rtPrintErr(FMT::tr(
"Cannot create temporary file: %1\n").arg(file->errorString()));
105 args << QStringLiteral(
"-out") << file->fileName();
106 const int exitCode = runInternalQtToolHelper(QStringLiteral(
"lprodump"), args);