fix stupid default support dir. if there's something we can't identify reliably, it's going to be a *nix

This commit is contained in:
Chris Forbes
2011-07-21 21:40:15 +12:00
parent 21f172228d
commit 2797ea72cb

View File

@@ -15,29 +15,18 @@ using OpenRA.FileFormats;
namespace OpenRA
{
public enum PlatformType
{
Unknown,
Windows,
OSX,
Linux
}
public enum PlatformType { Unknown, Windows, OSX, Linux }
public static class Platform
{
public static PlatformType CurrentPlatform
{
get
{
return currentPlatform.Value;
}
}
public static PlatformType CurrentPlatform { get { return currentPlatform.Value; } }
static Lazy<PlatformType> currentPlatform = new Lazy<PlatformType>(GetCurrentPlatform);
static PlatformType GetCurrentPlatform()
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT) return PlatformType.Windows;
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
return PlatformType.Windows;
try
{
@@ -60,17 +49,19 @@ namespace OpenRA
{
get
{
string dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
var dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
switch (CurrentPlatform)
{
case PlatformType.Windows:
dir += Path.DirectorySeparatorChar + "OpenRA";
break;
case PlatformType.OSX:
dir += "/Library/Application Support/OpenRA";
break;
case PlatformType.Linux:
dir += "/.openra";
break;
default:
dir += Path.DirectorySeparatorChar + "OpenRA";
dir += "/.openra";
break;
}