[xbuild] Use the env var $MSBuildExtensionsPath before trying other paths.
[mono.git] / mcs / class / Microsoft.Build.Engine / Microsoft.Build.BuildEngine / Import.cs
index 8f424e4f0ccfa7a66e438e04619d880242b6f465..9088babcfecf8444dc178ef46234374432af271f 100644 (file)
@@ -32,6 +32,7 @@ using System.IO;
 using System.Xml;
 
 using Microsoft.Build.Framework;
+using Mono.XBuild.Utilities;
 
 namespace Microsoft.Build.BuildEngine {
        public class Import {
@@ -42,7 +43,7 @@ namespace Microsoft.Build.BuildEngine {
 
                static string DotConfigExtensionsPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
                                                                Path.Combine ("xbuild", "tasks"));
-               static string MacOSXXBuildExternalDir = "/Library/Frameworks/Mono.framework/External/xbuild";
+               const string MacOSXExternalXBuildDir = "/Library/Frameworks/Mono.framework/External/xbuild";
        
                internal Import (XmlElement importElement, Project project, ImportedProject originalProject)
                {
@@ -120,9 +121,10 @@ namespace Microsoft.Build.BuildEngine {
                        string envvar = Environment.GetEnvironmentVariable (property_name);
                        envvar = String.Join (":", new string [] {
                                                (envvar ?? String.Empty),
-                                               DotConfigExtensionsPath,
-                                               // For mac osx, see bug #663180
-                                               (int)Environment.OSVersion.Platform == 6 ? MacOSXXBuildExternalDir : String.Empty });
+                                               // For mac osx, look in the 'External' dir on macosx,
+                                               // see bug #663180
+                                               MSBuildUtils.RunningOnMac ? MacOSXExternalXBuildDir : String.Empty,
+                                               DotConfigExtensionsPath});
 
                        string [] paths = envvar.Split (new char [] {':'}, StringSplitOptions.RemoveEmptyEntries);
                        foreach (string path in paths) {
@@ -172,7 +174,7 @@ namespace Microsoft.Build.BuildEngine {
                                        file = Path.Combine (dir, EvaluatedProjectPath);
                        }
                        
-                       return Utilities.FromMSBuildPath (file);
+                       return MSBuildUtils.FromMSBuildPath (file);
                }
                
                public string Condition {