X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=shared%2Fexecute-process-win.cpp;h=64a4a0aec8c95816dcc11b9da27aa4cab906ef27;hb=1b19fd140ff139b5854a1a62447faf31b175d8f6;hp=8445221625487a84a9077c4e061d0c4f1307e797;hpb=e8a20bc4f6a3d21c0eec25e62f00b6f54e39ed08;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/shared/execute-process-win.cpp b/shared/execute-process-win.cpp index 8445221..64a4a0a 100644 --- a/shared/execute-process-win.cpp +++ b/shared/execute-process-win.cpp @@ -15,38 +15,47 @@ * */ - // FILE HEADER +// FILE HEADER #include "execute-process.h" - // EXTERNAL INCLUDES -#include +// EXTERNAL INCLUDES #include +#include namespace { -const std::string PATH_SEPARATOR( "\\" ); +const std::string PATH_SEPARATOR("\\"); } -void ExecuteProcess( const std::string& processName, Dali::Application& application ) +void ExecuteProcess(const std::string& processName, Dali::Application& application) { - char currentPath[MAX_PATH]; - DWORD numberOfCharacters = GetCurrentDirectory( MAX_PATH, currentPath ); + std::string processPathName; - if( 0u == numberOfCharacters ) + const bool isRelativePath = '.' == DEMO_EXAMPLE_BIN[0]; + if(isRelativePath) { - DALI_ASSERT_ALWAYS( !"Failed to retrieve the current working directory" ); - } + char currentPath[MAX_PATH]; + DWORD numberOfCharacters = GetCurrentDirectory(MAX_PATH, currentPath); - currentPath[numberOfCharacters] = '\0'; + if(0u == numberOfCharacters) + { + DALI_ASSERT_ALWAYS(!"Failed to retrieve the current working directory"); + } - const std::string processPathName = std::string( currentPath ) + PATH_SEPARATOR + DEMO_EXAMPLE_BIN + PATH_SEPARATOR + processName + ".exe"; + currentPath[numberOfCharacters] = '\0'; + processPathName = std::string(currentPath) + PATH_SEPARATOR + DEMO_EXAMPLE_BIN + PATH_SEPARATOR + processName + ".exe"; + } + else + { + processPathName = DEMO_EXAMPLE_BIN + PATH_SEPARATOR + processName + ".exe"; + } - STARTUPINFO info = { sizeof( info ) }; + STARTUPINFO info = {sizeof(info)}; PROCESS_INFORMATION processInfo; - if( CreateProcess( processPathName.c_str(), nullptr, nullptr, nullptr, TRUE, 0, nullptr, nullptr, &info, &processInfo ) ) + if(CreateProcess(processPathName.c_str(), nullptr, nullptr, nullptr, TRUE, 0, nullptr, nullptr, &info, &processInfo)) { - WaitForSingleObject( processInfo.hProcess, INFINITE ); - CloseHandle( processInfo.hProcess ); - CloseHandle( processInfo.hThread ); + WaitForSingleObject(processInfo.hProcess, INFINITE); + CloseHandle(processInfo.hProcess); + CloseHandle(processInfo.hThread); } }