arguments << httpProxyAddr << httpProxyPort;
}
- QString loggingCommand = QString("staring ecp: \"" + command + "\"");
+ QString loggingCommand = QString("staring ecp: ");
+ command = QString("\"" + command + "\"");
+ loggingCommand += command;
+
+ QStringList wrapArguments;
for (int i = 0; i < arguments.size(); ++i) {
- loggingCommand += " \"" + arguments.at(i) + "\"";
+ QString wrapArgument = QString("\"" + arguments.at(i) + "\"");
+ wrapArguments << wrapArgument;
+ loggingCommand += " " + wrapArgument;
}
+
qInfo() << qPrintable(loggingCommand);
QString workingDir = QFileInfo(command).canonicalPath();
try {
+#ifndef CONFIG_WIN32
QProcess::startDetached(command, arguments, workingDir);
+#else
+ QString args = QString("\"" + command +"\"");
+ for (int i = 0; i < arguments.size(); ++i) {
+ args += " \"" + arguments.at(i) + "\"";
+ }
+ bool success = false;
+
+ PROCESS_INFORMATION pinfo;
+
+ STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
+ (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
+ (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ success = CreateProcessW(0, (wchar_t*)args.utf16(),
+ 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
+ workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(),
+ &startupInfo, &pinfo);
+
+ if (success) {
+ CloseHandle(pinfo.hThread);
+ CloseHandle(pinfo.hProcess);
+ }
+#endif
} catch (QString &error) {
showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error);
return;
#else
QString newCommand = QDir(QCoreApplication::applicationDirPath() +
QDir::separator() + SDK_EMULATOR_TOOLS_BIN_PATH +
- SDK_ECP_FILE + ".exe").absolutePath();
+ SDK_ECP_FILE + ".cmd").absolutePath();
#endif
if (QFileInfo(newCommand).exists()) {
command = newCommand;