private CommandLineBuilderJet GetPlatformCommandLine(FileSystemPath command, params string[] args) { var commandLine = new CommandLineBuilderJet(); if (PlatformUtil.RuntimePlatform == PlatformUtil.Platform.Windows) { commandLine.AppendFileName(command); } foreach (var arg in args) { commandLine.AppendSwitch(arg); } if (PlatformUtil.RuntimePlatform == PlatformUtil.Platform.Windows) { return(new CommandLineBuilderJet().AppendSwitch("/C") .AppendSwitch($"\"{commandLine}\"")); } return(commandLine); }
private bool RegenerateProjectUsingUBT(FileSystemPath uprojectFilePath, FileSystemPath pathToUnrealBuildToolBin, FileSystemPath engineRoot) { bool isInstalledBuild = IsInstalledBuild(engineRoot); var commandLine = new CommandLineBuilderJet() .AppendSwitch("-ProjectFiles") .AppendSwitch($"-project=\"{uprojectFilePath.FullPath}\"") .AppendSwitch("-game"); commandLine.AppendSwitch(isInstalledBuild ? "-rocket" : "-engine"); try { lock (HACK_getMutexForUBT()) { myLogger.Info($"[UnrealLink]: Regenerating project files: {commandLine}"); ErrorLevelException.ThrowIfNonZero(InvokeChildProcess.InvokeChildProcessIntoLogger( pathToUnrealBuildToolBin, commandLine, LoggingLevel.INFO, TimeSpan.FromMinutes(1), InvokeChildProcess.TreatStderr.AsOutput, pathToUnrealBuildToolBin.Directory )); } } catch (Exception errorLevelException) { myLogger.Error(errorLevelException, $"[UnrealLink]: Failed refresh project files: calling {commandLine}"); return(false); } return(true); }