diff --git a/src/Generator/Passes/GenerateSymbolsPass.cs b/src/Generator/Passes/GenerateSymbolsPass.cs index c6cd0f21..b1672ed7 100644 --- a/src/Generator/Passes/GenerateSymbolsPass.cs +++ b/src/Generator/Passes/GenerateSymbolsPass.cs @@ -157,15 +157,12 @@ namespace CppSharp.Passes int error; string errorMessage; ProcessHelper.Run(compiler, arguments, out error, out errorMessage); - if (string.IsNullOrEmpty(errorMessage)) - CollectSymbols(outputDir, symbols); - else - Diagnostics.Error(errorMessage); + CollectSymbols(outputDir, symbols, errorMessage); RemainingCompilationTasks--; }).Start(); } - private void CollectSymbols(string outputDir, string symbols) + private void CollectSymbols(string outputDir, string symbols, string errorMessage) { using (var parserOptions = new ParserOptions()) { @@ -173,6 +170,11 @@ namespace CppSharp.Passes var output = Path.GetFileName($@"{(Platform.IsWindows ? string.Empty : "lib")}{symbols}.{ (Platform.IsMacOS ? "dylib" : Platform.IsWindows ? "dll" : "so")}"); + if (!File.Exists(Path.Combine(outputDir, output))) + { + Diagnostics.Error(errorMessage); + return; + } parserOptions.LibraryFile = output; using (var parserResult = Parser.ClangParser.ParseLibrary(parserOptions)) { diff --git a/src/Generator/Utils/ProcessHelper.cs b/src/Generator/Utils/ProcessHelper.cs index 9b359c6e..d482b89f 100644 --- a/src/Generator/Utils/ProcessHelper.cs +++ b/src/Generator/Utils/ProcessHelper.cs @@ -1,14 +1,13 @@ -using System; -using System.Diagnostics; +using System.Diagnostics; using System.Text; namespace CppSharp.Utils { - public class ProcessHelper + public static class ProcessHelper { public static string Run(string path, string args, out int error, out string errorMessage) { - using (Process process = new Process()) + using (var process = new Process()) { process.StartInfo.FileName = path; process.StartInfo.Arguments = args;