#region CPL License /* Nuclex.NAnt.Tasks Copyright (C) 2009 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #endregion using System; using System.Collections.Generic; using System.Text; namespace Nuclex.NAnt.Tasks.Helpers { /// Helper methods for detecting the operating system internal class OsHelper { /// Initializes the OsHelper static OsHelper() { OperatingSystem os = Environment.OSVersion; IsXpOrLater = (os.Platform == PlatformID.Win32NT) && (os.Version >= new Version(5, 1)); IsVistaOrLater = (os.Platform == PlatformID.Win32NT) && (os.Version >= new Version(6, 0)); IsWindows = (os.Platform == PlatformID.Win32NT) || (os.Platform == PlatformID.Win32Windows); IsUnix = (os.Platform == PlatformID.Unix) || (os.Platform == PlatformID.MacOSX); } /// Whether the user is running Windows XP or later public static readonly bool IsXpOrLater; /// Whether the user is running Windows Vista or later public static readonly bool IsVistaOrLater; /// Whether the user is running Windows public static readonly bool IsWindows; /// Whether the user is running Unix public static readonly bool IsUnix; } } // namespace Nuclex.NAnt.Tasks.Helpers