string SetAlPath (ProcessStartInfo info)
{
if (RuntimeHelpers.RunningOnWindows) {
string alPath;
string monoPath;
PropertyInfo gac = typeof (Environment).GetProperty ("GacPath", BindingFlags.Static|BindingFlags.NonPublic);
MethodInfo get_gac = gac.GetGetMethod (true);
string p = Path.GetDirectoryName ((string) get_gac.Invoke (null, null));
monoPath = Path.Combine (Path.GetDirectoryName (Path.GetDirectoryName (p)), "bin\\mono.bat");
if (!File.Exists (monoPath)) {
monoPath = Path.Combine (Path.GetDirectoryName (Path.GetDirectoryName (p)), "bin\\mono.exe");
if (!File.Exists (monoPath)) {
monoPath = Path.Combine (Path.GetDirectoryName (Path.GetDirectoryName (Path.GetDirectoryName (p))), "mono\\mono\\mini\\mono.exe");
if (!File.Exists (monoPath))
throw new FileNotFoundException ("Windows mono path not found: " + monoPath);
}
}
#if NET_4_0
alPath = Path.Combine (p, "4.0\\al.exe");
#else
alPath = Path.Combine (p, "2.0\\al.exe");
#endif
if (!File.Exists (alPath)) {
#if NET_4_0
alPath = Path.Combine(Path.GetDirectoryName (p), "lib\\net_4_0\\al.exe");
#else
alPath = Path.Combine(Path.GetDirectoryName (p), "lib\\net_2_0\\al.exe");
#endif
if (!File.Exists (alPath))
throw new FileNotFoundException ("Windows al path not found: " + alPath);
}
info.FileName = monoPath;
return alPath + " ";
} else {
#if NET_4_0
info.FileName = "al";
#else
info.FileName = "al2";
#endif
return String.Empty;
}
}