mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-14 23:58:12 +03:00
50 lines
904 B
C#
50 lines
904 B
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace Steamworks
|
|
{
|
|
public static class Config
|
|
{
|
|
static OsType _os;
|
|
public static OsType Os
|
|
{
|
|
get
|
|
{
|
|
if ( _os == OsType.None )
|
|
{
|
|
string windir = Environment.GetEnvironmentVariable( "windir" );
|
|
if ( !string.IsNullOrEmpty( windir ) && windir.Contains( @"\" ) && Directory.Exists( windir ) )
|
|
{
|
|
_os = OsType.Windows;
|
|
}
|
|
else if ( File.Exists( @"/System/Library/CoreServices/SystemVersion.plist" ) )
|
|
{
|
|
_os = OsType.Posix;
|
|
}
|
|
else if ( File.Exists( @"/proc/sys/kernel/ostype" ) )
|
|
{
|
|
_os = OsType.Posix;
|
|
}
|
|
else
|
|
{
|
|
throw new System.Exception( "Couldn't determine operating system" );
|
|
}
|
|
}
|
|
|
|
return _os;
|
|
}
|
|
|
|
set => _os = value;
|
|
}
|
|
|
|
public static bool PackSmall => Os != OsType.Windows;
|
|
}
|
|
|
|
public enum OsType
|
|
{
|
|
None,
|
|
Windows,
|
|
Posix,
|
|
}
|
|
}
|