(string action)
| 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 | { |
no test coverage detected