1 // created on 6/8/2004 at 5:44 AM
3 using System.Diagnostics;
5 namespace Mfconsulting.General
7 public sealed class PkgConfigInvoker
10 public static string GetPkgConfigVersion()
14 pkgout = RunPkgConfig("--version");
24 public static string GetPkgVariableValue(string strPkg, string strVarName)
28 pkgout = RunPkgConfig(String.Format("--variable={0} {1}",
39 public static string GetPkgConfigModuleVersion(string strPkg)
43 pkgout = RunPkgConfig(String.Format("--modversion {0}", strPkg));
53 public static string RunPkgConfig(string strArgLine)
57 ProcessStartInfo pi = new ProcessStartInfo ();
58 pi.FileName = "pkg-config";
59 pi.RedirectStandardOutput = true;
60 pi.UseShellExecute = false;
61 pi.Arguments = strArgLine;
65 p = Process.Start (pi);
69 Console.WriteLine("Couldn't run pkg-config: " + e.Message);
73 if (p.StandardOutput == null)
75 Console.WriteLine("Specified package did not return any information");
78 pkgout = p.StandardOutput.ReadToEnd ();
82 Console.WriteLine("Error running pkg-config. Check the above output.");