Commit 62e7c096309f5fb4dc98378f86dad3d80a972fae

Authored by Victor Cebollada
1 parent 43148aab

Windows execute process fix.

* The path set on the DEMO_EXAMPLE_BIN macro can be absolute or
  relative depending on the build system (cmake, vs project, etc).

Change-Id: I802530cbf5109b2b6db962c8e3801a74f7b86a4a
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
Showing 1 changed file with 16 additions and 7 deletions
shared/execute-process-win.cpp
... ... @@ -29,17 +29,26 @@ const std::string PATH_SEPARATOR( &quot;\\&quot; );
29 29  
30 30 void ExecuteProcess( const std::string& processName, Dali::Application& application )
31 31 {
32   - char currentPath[MAX_PATH];
33   - DWORD numberOfCharacters = GetCurrentDirectory( MAX_PATH, currentPath );
  32 + std::string processPathName;
34 33  
35   - if( 0u == numberOfCharacters )
  34 + const bool isRelativePath = '.' == DEMO_EXAMPLE_BIN[0];
  35 + if (isRelativePath)
36 36 {
37   - DALI_ASSERT_ALWAYS( !"Failed to retrieve the current working directory" );
38   - }
  37 + char currentPath[MAX_PATH];
  38 + DWORD numberOfCharacters = GetCurrentDirectory( MAX_PATH, currentPath );
39 39  
40   - currentPath[numberOfCharacters] = '\0';
  40 + if( 0u == numberOfCharacters )
  41 + {
  42 + DALI_ASSERT_ALWAYS( !"Failed to retrieve the current working directory" );
  43 + }
41 44  
42   - const std::string processPathName = std::string( currentPath ) + PATH_SEPARATOR + DEMO_EXAMPLE_BIN + PATH_SEPARATOR + processName + ".exe";
  45 + currentPath[numberOfCharacters] = '\0';
  46 + processPathName = std::string(currentPath) + PATH_SEPARATOR + DEMO_EXAMPLE_BIN + PATH_SEPARATOR + processName + ".exe";
  47 + }
  48 + else
  49 + {
  50 + processPathName = DEMO_EXAMPLE_BIN + PATH_SEPARATOR + processName + ".exe";
  51 + }
43 52  
44 53 STARTUPINFO info = { sizeof( info ) };
45 54 PROCESS_INFORMATION processInfo;
... ...