I'm working on a tool that generates some files for Unreal Projects. The only thing is if I try to get it to compile the project through CreateProcess the command doesn't run the same as the command line. I just get an error message from UBT about rule files not existing.
Command being run from CreateProcess:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
CreateProcess("C:/path/to/UnrealBuildTool.exe",
"ProjectEditor Win64 Development C:/path/to/project.uproject -waitmutex -Deploy",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi
);
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
In the command line C:\path\to\UnrealBuildTool.exe ProjectEditor Win64 Development C:\path\to\project.uproject -waitmutext -Deploy successfully compiles the project from any directory. Is there any other variables I need to pass into CreateProcess to get this command to run?
EDIT: Adding space to the start of the argument string fixed the issue. Is there any reason why Windows would need that space?