uint32 FLocalServerRunnable::Run()
{
if (!bLocalServer)
{
return 0;
}
if (CreatedProc.IsValid())
{
return 0;
}
FString LocalServerPath;
const int nBufSize = 512;
TCHAR ChBuf[nBufSize];
ZeroMemory(ChBuf, nBufSize);
const TCHAR* Url;
if (GetModuleFileName(NULL, ChBuf, nBufSize))
{
LocalServerPath = ChBuf;
int32 Index = UKismetStringLibrary::FindSubstring(LocalServerPath, “\\”, false, true, LocalServerPath.Len() – 1);
LocalServerPath = UKismetStringLibrary::GetSubstring(LocalServerPath, 0, Index).Append(TEXT(“\\”));
LocalServerPath = LocalServerPath.Append(LOCALSERVER_URL);
Url = *LocalServerPath;
CreatedProc = FPlatformProcess::CreateProc(Url, TEXT(“-log -local”), true, true, false, &ProcessId, -1, nullptr, nullptr);
if (CreatedProc.IsValid())
{
UE_LOG(LogClass, Log, TEXT(“Create Sigle PradaServer Successful! %s”), *LocalServerPath);
}
else
{
UE_LOG(LogClass, Log, TEXT(“Create Sigle PradaServer Failed! %s”), *LocalServerPath);
}
}
return 0;
}