MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ExecuteAction

Function ExecuteAction

Source/Editor/Windows/GameCookerWindow.cs:897–923  ·  view source on GitHub ↗
(string action)

Source from the content-addressed store, hash-verified

895 }
896
897 private void ExecuteAction(string action)
898 {
899 string command = "echo off\ncd \"" + Globals.ProjectFolder.Replace('/', '\\') + "\"\necho on\n" + action;
900 command = command.Replace("\n", "\r\n");
901
902 // TODO: postprocess text using $(OutputPath) etc. macros
903 // TODO: capture std out of the action (maybe call system() to execute it)
904
905 try
906 {
907 var tmpBat = StringUtils.CombinePaths(Globals.TemporaryFolder, Guid.NewGuid().ToString("N") + ".bat");
908 File.WriteAllText(tmpBat, command);
909 var procSettings = new CreateProcessSettings
910 {
911 FileName = tmpBat,
912 HiddenWindow = true,
913 WaitForEnd = true,
914 };
915 Platform.CreateProcess(ref procSettings);
916 File.Delete(tmpBat);
917 }
918 catch (Exception ex)
919 {
920 Editor.LogWarning(ex);
921 Debug.LogError("Failed to execute build action.");
922 }
923 }
924
925 internal void ExitOnBuildQueueEnd()
926 {

Callers 1

OnGameCookerEventFunction · 0.85

Calls 8

ReplaceMethod · 0.80
CombinePathsMethod · 0.80
WriteAllTextMethod · 0.80
ToStringMethod · 0.45
CreateProcessMethod · 0.45
DeleteMethod · 0.45
LogWarningMethod · 0.45
LogErrorMethod · 0.45

Tested by

no test coverage detected