bool FVSAccessorModule::RunVisualStudioAndOpenSolution() const { bool bSuccess = false; FString Path; if ( CanRunVisualStudio( Path ) ) { FString Params; if ( FModuleManager::Get().IsSolutionFilePresent() ) { Params += TEXT("\""); Params += FModuleManager::Get().GetSolutionFilepath(); Params += TEXT("\""); FProcHandle WorkerHandle = FPlatformProcess::CreateProc( *Path, *Params, true, false, false, NULL, 0, NULL, NULL ); if ( WorkerHandle.IsValid() ) { bSuccess = true; } WorkerHandle.Close(); } } return bSuccess; }
bool FLinuxTargetDevice::Launch( const FString& AppId, EBuildConfigurations::Type BuildConfiguration, EBuildTargets::Type BuildTarget, const FString& Params, uint32* OutProcessId ) { #if PLATFORM_LINUX // if running natively, support launching in place // build executable path FString PlatformName = TEXT("Linux"); FString ExecutablePath = FPaths::EngineIntermediateDir() / TEXT("Devices") / PlatformName / TEXT("Engine") / TEXT("Binaries") / PlatformName; if (BuildTarget == EBuildTargets::Game) { ExecutablePath /= TEXT("UE4Game"); } else if (BuildTarget == EBuildTargets::Server) { ExecutablePath /= TEXT("UE4Server"); } else if (BuildTarget == EBuildTargets::Editor) { ExecutablePath /= TEXT("UE4Editor"); } if (BuildConfiguration != EBuildConfigurations::Development) { ExecutablePath += FString::Printf(TEXT("-%s-%s"), *PlatformName, EBuildConfigurations::ToString(BuildConfiguration)); } // launch the game FProcHandle ProcessHandle = FPlatformProcess::CreateProc(*ExecutablePath, *Params, true, false, false, OutProcessId, 0, NULL, NULL); return ProcessHandle.Close(); #else // @todo: support launching on a remote machine STUBBED("FLinuxTargetDevice::Launch"); return false; #endif // PLATFORM_LINUX }
bool FBuildPatchInstaller::RunPrereqInstaller() { FString PrereqPath = InstallDirectory / NewBuildManifest->GetPrereqPath(); PrereqPath = FPaths::ConvertRelativePathToFull(PrereqPath); FString PrereqCommandline = NewBuildManifest->GetPrereqArgs(); GLog->Logf(TEXT("BuildPatchServices: Running prerequisites installer %s %s"), *PrereqPath, *PrereqCommandline); BuildProgress.SetStateProgress(EBuildPatchProgress::PrerequisitesInstall, 0.0f); // @TODO: Tell our installer to run with no UI since we will have BuildPatchProgress // @TODO: Pass in params to the installer that tell it to fire up the portal/launcher after install if it has to perform a restart. FProcHandle ProcessHandle = FPlatformProcess::CreateProc(*PrereqPath, *PrereqCommandline, true, false, false, NULL, 0, *FPaths::GetPath(PrereqPath), NULL); bool bPrereqInstallSuccessful = true; if (!ProcessHandle.IsValid()) { GLog->Logf(TEXT("BuildPatchServices: ERROR: Failed to start the prerequisites install process.")); FBuildPatchAnalytics::RecordPrereqInstallnError(PrereqPath, PrereqCommandline, -1, TEXT("Failed to start installer")); // @TODO: Do we need to do anything special to fail? bPrereqInstallSuccessful = false; } int32 ReturnCode; if (bPrereqInstallSuccessful) { FPlatformProcess::WaitForProc(ProcessHandle); FPlatformProcess::GetProcReturnCode(ProcessHandle, &ReturnCode); ProcessHandle.Close(); if (ReturnCode != 0) { if (ReturnCode == 3010) { GLog->Logf(TEXT("BuildPatchServices: Prerequisites executable returned restart required code %d"), ReturnCode); // @TODO: Inform app that system restart is required } else { GLog->Logf(TEXT("BuildPatchServices: ERROR: Prerequisites executable failed with code %d"), ReturnCode); FBuildPatchAnalytics::RecordPrereqInstallnError(PrereqPath, PrereqCommandline, ReturnCode, TEXT("Failed to install")); bPrereqInstallSuccessful = false; } } } if (bPrereqInstallSuccessful) { BuildProgress.SetStateProgress(EBuildPatchProgress::PrerequisitesInstall, 1.0f); } else { FBuildPatchInstallError::SetFatalError(EBuildPatchInstallError::PrerequisiteError); } return bPrereqInstallSuccessful; }
bool FLinuxTargetDevice::Run( const FString& ExecutablePath, const FString& Params, uint32* OutProcessId ) { #if PLATFORM_LINUX // if running natively, support simplified, local deployment FProcHandle ProcessHandle = FPlatformProcess::CreateProc(*ExecutablePath, *Params, true, false, false, OutProcessId, 0, NULL, NULL); return ProcessHandle.Close(); #else // @todo: support remote run STUBBED("FLinuxTargetDevice::Run"); return false; #endif // PLATFORM_LINUX }