46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "createProcessBPLibrary.h"
|
|
#include "createProcess.h"
|
|
|
|
UcreateProcessBPLibrary::UcreateProcessBPLibrary(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
|
|
}
|
|
|
|
void UcreateProcessBPLibrary::createProc(FString FullPathOfProgramToRun, TArray<FString> CommandlineArgs, bool Detach, bool Hidden, int32 Priority, FString OptionalWorkingDirectory)
|
|
{ //Please note ProcessId should really be uint32 but that is not supported by BP yet
|
|
|
|
FString Args = "";
|
|
if (CommandlineArgs.Num() > 1)
|
|
{
|
|
Args = CommandlineArgs[0];
|
|
for (int32 v = 1; v < CommandlineArgs.Num(); v++)
|
|
{
|
|
Args += " " + CommandlineArgs[v];
|
|
}
|
|
}
|
|
else if (CommandlineArgs.Num() > 0)
|
|
{
|
|
Args = CommandlineArgs[0];
|
|
}
|
|
|
|
//uint32 NeedBPUINT32 = 0;
|
|
FPlatformProcess::CreateProc(
|
|
*FullPathOfProgramToRun,
|
|
*Args,
|
|
Detach,//* @param bLaunchDetached if true, the new process will have its own window
|
|
false,//* @param bLaunchHidded if true, the new process will be minimized in the task bar
|
|
Hidden,//* @param bLaunchReallyHidden if true, the new process will not have a window or be in the task bar
|
|
0,
|
|
Priority,
|
|
(OptionalWorkingDirectory != "") ? *OptionalWorkingDirectory : nullptr,//const TCHAR* OptionalWorkingDirectory,
|
|
nullptr
|
|
);
|
|
}
|
|
|
|
void UcreateProcessBPLibrary::RunSystemCommand(FString Command)
|
|
{
|
|
system(TCHAR_TO_ANSI(*Command));
|
|
} |