Просмотр исходного кода

修复生成proto错误却不显示具体错误的bug

tanghai 7 лет назад
Родитель
Сommit
e981155891
4 измененных файлов с 5 добавлено и 5 удалено
  1. BIN
      Proto/Proto2CS.dll
  2. BIN
      Proto/Proto2CS.pdb
  3. 2 2
      Tools/Proto2CS/Program.cs
  4. 3 3
      Unity/Assets/Model/Base/ProcessHelper.cs

BIN
Proto/Proto2CS.dll


BIN
Proto/Proto2CS.pdb


+ 2 - 2
Tools/Proto2CS/Program.cs

@@ -27,8 +27,8 @@ namespace ETTools
             {
                 protoc = "protoc";
             }
-            ProcessHelper.Run(protoc, "--csharp_out=\"../Unity/Assets/Model/Module/Message/\" --proto_path=\"./\" OuterMessage.proto");
-            ProcessHelper.Run(protoc, "--csharp_out=\"../Unity/Assets/Hotfix/Module/Message/\" --proto_path=\"./\" HotfixMessage.proto");
+            ProcessHelper.Run(protoc, "--csharp_out=\"../Unity/Assets/Model/Module/Message/\" --proto_path=\"./\" OuterMessage.proto", waitExit: true);
+            ProcessHelper.Run(protoc, "--csharp_out=\"../Unity/Assets/Hotfix/Module/Message/\" --proto_path=\"./\" HotfixMessage.proto", waitExit: true);
 
             // InnerMessage.proto生成cs代码
             InnerProto2CS.Proto2CS(); 

+ 3 - 3
Unity/Assets/Model/Base/ProcessHelper.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Diagnostics;
 using System.Runtime.InteropServices;
+using Path = System.IO.Path;
 
 namespace ETModel
 {
@@ -45,8 +46,7 @@ namespace ETModel
                     process.WaitForExit();
                     if (process.ExitCode != 0)
                     {
-                        throw new Exception(process.StandardOutput.ReadToEnd() + process.StandardError.ReadToEnd() + "\n"
-                            + $"请在terminal中执行,目录{workingDirectory}, 命令{exe} {arguments}");
+                        throw new Exception($"{process.StandardOutput.ReadToEnd()} {process.StandardError.ReadToEnd()}");
                     }
                 }
 
@@ -54,7 +54,7 @@ namespace ETModel
             }
             catch (Exception e)
             {
-                throw new Exception($"请在terminal中执行,目录{workingDirectory}, 命令{exe} {arguments}", e);
+                throw new Exception($"dir: {Path.GetFullPath(workingDirectory)}, command: {exe} {arguments}", e);
             }
         }
     }