From: Munkyu Im Date: Thu, 4 Aug 2016 05:38:21 +0000 (+0900) Subject: ecp: wrap launcher to launch ecp on Windows X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~30^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4fdc24fc3a46ac547829b009e7aace5e844dfd19;p=sdk%2Femulator%2Fqemu.git ecp: wrap launcher to launch ecp on Windows Change-Id: I1592ba1a09a76e3989684e7f7b3451f8ee9b7079 Signed-off-by: Munkyu Im Signed-off-by: SeokYeon Hwang --- diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 2a31c7d195..90e02b30b7 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -953,15 +953,47 @@ void ContextMenu::launchControlPanel(QString& command, 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; @@ -983,7 +1015,7 @@ void ContextMenu::slotControlPanel() #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;