23 #include "apprunner.h"
25 #include "gui/standardserverconsole.h"
27 #include "serverapi/message.h"
28 #include "strings.hpp"
38 QStringList::iterator it;
39 for (it = args.begin(); it != args.end(); ++it)
41 if (it->contains(
" "))
42 Strings::trim(*it,
"\"");
47 QString AppRunner::findBundleBinary(
const QFileInfo &file)
52 QFile pLists(file.canonicalFilePath() +
"/Contents/Info.plist");
53 if (!pLists.open(QIODevice::ReadOnly | QIODevice::Text))
55 gLog << tr(
"Could not read bundle plist. (%1)").arg(file.canonicalFilePath() +
"/Contents/Info.plist");
60 bool keyFound =
false;
61 while (pLists.readLine(line, 128) != -1)
65 if (QString(line).trimmed() ==
"<key>CFBundleExecutable</key>")
70 QString binaryLine(line);
71 binaryLine = binaryLine.trimmed();
72 if (binaryLine.startsWith(
"<string>") && binaryLine.endsWith(
"</string>"))
73 return QString(
"/Contents/MacOS/") + binaryLine.mid(8, binaryLine.indexOf(
"</string>") - 8);
83 gLog << tr(
"Starting (working dir %1): %2").arg(cmdInfo.
applicationDir.absolutePath()).arg(cmdInfo.
executable.absoluteFilePath());
84 QStringList args = cmdInfo.
args;
91 result = QProcess::startDetached(cmdInfo.
executable.absoluteFilePath() + AppRunner::findBundleBinary(cmdInfo.
executable), args, cmdInfo.
applicationDir.absolutePath());
95 result = QProcess::startDetached(cmdInfo.
executable.absoluteFilePath(), args, cmdInfo.
applicationDir.absolutePath());
102 QString error = tr(
"Cannot run file: %1").arg(cmdInfo.
executable.absoluteFilePath());
114 gLog << tr(
"Starting (working dir %1): %2").arg(cli.
applicationDir.absolutePath())
116 QStringList args = cli.
args;