Skip to content

Commit ca8fb86

Browse files
committed
Fixes for Windows
1 parent 0670ccd commit ca8fb86

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/main/ipc/Process.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace lsp
5757
namespace ipc
5858
{
5959

60-
#ifndef PLATFORM_HAS_EXECVPE
60+
#if defined(PLATFORM_WINDOWS) || (!defined(PLATFORM_HAS_EXECVPE))
6161
static status_t find_executable(LSPString & program, const LSPString & command)
6262
{
6363
if (command.index_of(FILE_SEPARATOR_C) >= 0)
@@ -106,7 +106,7 @@ namespace lsp
106106
program.set_length(program.length() - 4);
107107
if (!program.append_ascii(".com"))
108108
return STATUS_NO_MEM;
109-
if (PathFileExistsW(ppath))
109+
if (PathFileExistsW(program.get_utf16()))
110110
return STATUS_OK;
111111
}
112112
#else
@@ -836,16 +836,19 @@ namespace lsp
836836
if (sCommand.is_empty())
837837
return STATUS_BAD_STATE;
838838

839-
// Form argv
840-
LSPString argv;
841-
status_t res = build_argv(&argv);
842-
if (res != STATUS_OK)
839+
// Obtain the command string
840+
status_t res;
841+
LSPString xcmd;
842+
res = find_executable(xcmd, sCommand);
843+
if ((res != STATUS_OK) && (res != STATUS_NOT_FOUND))
843844
return res;
845+
LSPString & program = (res == STATUS_OK) ? xcmd : sCommand;
844846

845-
// Form envp
846-
LSPString envp;
847-
res = build_envp(&envp);
848-
if (res != STATUS_OK)
847+
// Form argv and envp
848+
LSPString argv, envp;
849+
if ((res = build_argv(&argv)) != STATUS_OK)
850+
return res;
851+
if ((res = build_envp(&envp)) != STATUS_OK)
849852
return res;
850853

851854
// Launch child process
@@ -887,7 +890,7 @@ namespace lsp
887890

888891
// Start the child process.
889892
if( !::CreateProcessW(
890-
sCommand.get_utf16(), // Module name (use command line)
893+
program.get_utf16(), // Module name (use command line)
891894
wargv, // Command line
892895
NULL, // Process handle not inheritable
893896
NULL, // Thread handle not inheritable

0 commit comments

Comments
 (0)