using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
namespace Sog
{
public enum OSType
{
None = 0,
Windows = 1,
Linux = 2,
}
public static class OSUtils
{
private static OSType m_osType = OSType.None;
public static bool IsWindows()
{
Init();
return m_osType == OSType.Windows;
}
///
/// 判断是否存在逻辑不是很严格,能用就行
///
///
private static void Init()
{
if(m_osType != OSType.None)
{
return;
}
if (Directory.Exists("C:") || Directory.Exists("D:"))
{
m_osType = OSType.Windows;
}
else
{
m_osType = OSType.Linux;
}
}
public static string GetFilePathSeparator()
{
if(IsWindows())
{
return "\\";
}
else
{
return "/";
}
//return Path.DirectorySeparatorChar;
}
}
}