Using running process to determine mono exe path on windows
[mono.git] / mcs / class / System.Web / System.Web.Compilation / AppResourcesAssemblyBuilder.cs
index 895440d3a6a8ec33f843523b24777261e37e3014..064fbde4322c713601865c6381a2ca9feda872e4 100644 (file)
@@ -47,8 +47,6 @@ namespace System.Web.Compilation
 {
        class AppResourcesAssemblyBuilder
        {
-               static string framework_version = "4.5";
-               static string profile_path = "net_4_x";
                CompilationSection config;
                CompilerInfo ci;
                CodeDomProvider _provider;
@@ -233,36 +231,14 @@ namespace System.Web.Compilation
                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);
-                                       }
-                               }
-                               alPath = Path.Combine (p, framework_version + "\\al.exe");
-                               
-                                if (!File.Exists (alPath)) {
-                                       alPath = Path.Combine (Path.GetDirectoryName (p), "lib\\" + profile_path + "\\al.exe");
-                                       if (!File.Exists (alPath))
-                                               throw new FileNotFoundException ("Windows al path not found: " + alPath);
-                               }
-
-                               info.FileName = monoPath;
-                               return alPath + " ";
+                               info.FileName = MonoExeLocator.MonoPath;
+                               return MonoExeLocator.AlPath + " ";
                        } else {
-                               info.FileName = "al";
+                               info.FileName = MonoExeLocator.AlPath;
                                return String.Empty;
                        }
                }
-               
+
                string BuildAssemblyPath (string cultureName)
                {
                        string baseDir = Path.Combine (baseAssemblyDirectory, cultureName);