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