* Project.cs (OS): New.
authorAnkit Jain <radical@corewars.org>
Fri, 2 Oct 2009 22:00:39 +0000 (22:00 -0000)
committerAnkit Jain <radical@corewars.org>
Fri, 2 Oct 2009 22:00:39 +0000 (22:00 -0000)
(InitializeProperties): Set 'OS' as a pre-defined property, set to
'Windows_NT', 'Unix' or 'OSX' depending on the platform.

svn path=/trunk/mcs/; revision=143314

mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs

index ff17581c295d4330f63edb4b47e70252b8a7535e..1d06008ffd2e5e494781c42040593f19c67d2dc4 100644 (file)
@@ -1,3 +1,9 @@
+2009-10-03  Ankit Jain  <jankit@novell.com>
+
+       * Project.cs (OS): New.
+       (InitializeProperties): Set 'OS' as a pre-defined property, set to
+       'Windows_NT', 'Unix' or 'OSX' depending on the platform.
+
 2009-10-02  Ankit Jain  <jankit@novell.com>
 
        * Expression.cs (Parse): Don't change '/' to '\\', not required.
index a6af58a233b9b69d05f01d496c998e064fcc7e1a..68c56012a1badb4980c75a0e274cff98cb1f79ad 100644 (file)
@@ -900,6 +900,7 @@ namespace Microsoft.Build.BuildEngine {
                        EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsPath", parentEngine.BinPath, PropertyType.Reserved));
                        EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath", ExtensionsPath, PropertyType.Reserved));
                        EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDefaultTargets", DefaultTargets, PropertyType.Reserved));
+                       EvaluatedProperties.AddProperty (new BuildProperty ("OS", OS, PropertyType.Environment));
 
                        // FIXME: make some internal method that will work like GetDirectoryName but output String.Empty on null/String.Empty
                        string projectDir;
@@ -1277,6 +1278,22 @@ namespace Microsoft.Build.BuildEngine {
                internal static string XmlNamespace {
                        get { return ns; }
                }
+
+               static string OS {
+                       get {
+                               PlatformID pid = Environment.OSVersion.Platform;
+                               switch ((int)pid) {
+                               case 128:
+                               case 4:
+                                       return "Unix";
+                               case 6:
+                                       return "OSX";
+                               default:
+                                       return "Windows_NT";
+                               }
+                       }
+               }
+
        }
 }