mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System;
|
|
using System.IO;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Robust.Client.Utility
|
|
{
|
|
internal static class UserDataDir
|
|
{
|
|
[Pure]
|
|
public static string GetUserDataDir()
|
|
{
|
|
string appDataDir;
|
|
|
|
#if LINUX
|
|
var xdgDataHome = Environment.GetEnvironmentVariable("XDG_DATA_HOME");
|
|
if (xdgDataHome == null)
|
|
{
|
|
appDataDir = Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share");
|
|
}
|
|
else
|
|
{
|
|
appDataDir = xdgDataHome;
|
|
}
|
|
#elif MACOS
|
|
appDataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
|
"Library", "Application Support");
|
|
#else
|
|
appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
|
#endif
|
|
|
|
return Path.Combine(appDataDir, IoCManager.Resolve<IGameControllerInternal>().Options.UserDataDirectoryName, "data");
|
|
}
|
|
|
|
}
|
|
}
|