Author: lluis
Date: 2007-09-27 07:40:43 -0400 (Thu, 27 Sep 2007)
New Revision: 86484
Modified:
branches/monodevelop/0.16/Extras/CBinding/ChangeLog
branches/monodevelop/0.16/Extras/CBinding/Compiler/GNUCompiler.cs
branches/monodevelop/0.16/Extras/CBinding/Parser/TagDatabaseManager.cs
Log:
2007-09-26 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* Parser/TagDatabaseManager.cs: Don't crash if the compiler can't be
found.
* Compiler/GNUCompiler.cs: Check for the compiler before trying to
compile.
Modified: branches/monodevelop/0.16/Extras/CBinding/ChangeLog
===================================================================
--- branches/monodevelop/0.16/Extras/CBinding/ChangeLog 2007-09-27 11:39:15 UTC
(rev 86483)
+++ branches/monodevelop/0.16/Extras/CBinding/ChangeLog 2007-09-27 11:40:43 UTC
(rev 86484)
@@ -1,3 +1,8 @@
+2007-09-26 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * Parser/TagDatabaseManager.cs: Don't crash if the compiler can't be
found.
+ * Compiler/GNUCompiler.cs: Check for the compiler before trying to
compile.
+
2007-09-21 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* CBinding.addin.xml: Bump MD version.
Modified: branches/monodevelop/0.16/Extras/CBinding/Compiler/GNUCompiler.cs
===================================================================
--- branches/monodevelop/0.16/Extras/CBinding/Compiler/GNUCompiler.cs
2007-09-27 11:39:15 UTC (rev 86483)
+++ branches/monodevelop/0.16/Extras/CBinding/Compiler/GNUCompiler.cs
2007-09-27 11:40:43 UTC (rev 86484)
@@ -50,12 +50,34 @@
{
public abstract class GNUCompiler : CCompiler
{
+ bool appsChecked;
+ bool compilerFound;
+ bool linkerFound;
+
public override ICompilerResult Compile (
ProjectFileCollection projectFiles,
ProjectPackageCollection packages,
CProjectConfiguration configuration,
IProgressMonitor monitor)
{
+ if (!appsChecked) {
+ appsChecked = true;
+ compilerFound = CheckApp (compilerCommand);
+ linkerFound = CheckApp (linkerCommand);
+ }
+
+ if (!compilerFound) {
+ DefaultCompilerResult cres = new
DefaultCompilerResult ();
+ cres.AddError ("Compiler not found: " +
compilerCommand);
+ return cres;
+ }
+
+ if (!linkerFound) {
+ DefaultCompilerResult cres = new
DefaultCompilerResult ();
+ cres.AddError ("Linker not found: " +
linkerCommand);
+ return cres;
+ }
+
CompilerResults cr = new CompilerResults (new
TempFileCollection ());
bool res = true;
string args = GetCompilerFlags (configuration);
@@ -588,5 +610,16 @@
return p.StandardOutput.ReadToEnd();
}
+
+ bool CheckApp (string app)
+ {
+ try {
+ ProcessWrapper p =
Runtime.ProcessService.StartProcess (linkerCommand, "--version", null, null);
+ p.WaitForOutput ();
+ return true;
+ } catch {
+ return false;
+ }
+ }
}
}
Modified: branches/monodevelop/0.16/Extras/CBinding/Parser/TagDatabaseManager.cs
===================================================================
--- branches/monodevelop/0.16/Extras/CBinding/Parser/TagDatabaseManager.cs
2007-09-27 11:39:15 UTC (rev 86483)
+++ branches/monodevelop/0.16/Extras/CBinding/Parser/TagDatabaseManager.cs
2007-09-27 11:40:43 UTC (rev 86484)
@@ -90,8 +90,14 @@
internal string[] Headers (string filename, bool with_system)
{
string option = (with_system ? "-M" : "-MM");
- ProcessWrapper p = Runtime.ProcessService.StartProcess
("gcc", option + " -MG " + filename, null, null);
- p.WaitForExit ();
+ ProcessWrapper p;
+ try {
+ p = Runtime.ProcessService.StartProcess ("gcc",
option + " -MG " + filename, null, null);
+ p.WaitForExit ();
+ } catch (Exception ex) {
+ Runtime.LoggingService.Error (ex);
+ return new string [0];
+ }
StringBuilder output = new StringBuilder ();
string line;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches