diff options
| author | Bond_009 <bond.009@outlook.com> | 2018-12-13 11:30:39 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2018-12-13 11:33:27 +0100 |
| commit | b79f6e4ba0c2aa761b2fe016ca531dfdf6273b0e (patch) | |
| tree | fe430537425f6e35d52db405f7eeda719596c3a4 | |
| parent | 0f5c0cca3768efd106192add90090c893b2ea60c (diff) | |
Use XDG_DATA_HOME as base path for *nix sytems
| -rw-r--r-- | MediaBrowser.Server.Mono/Program.cs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 8d0c9ee0e..21de06ccc 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -90,14 +90,21 @@ namespace MediaBrowser.Server.Mono { if (InteropServices.RuntimeInformation.IsOSPlatform(InteropServices.OSPlatform.Windows)) { - programDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "jellyfin"); + programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); } else { - programDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".jellyfin"); + // $XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. + programDataPath = Environment.GetEnvironmentVariable("XDG_DATA_HOME"); + // If $XDG_DATA_HOME is either not set or empty, $HOME/.local/share should be used. + if (string.IsNullOrEmpty(programDataPath)){ + programDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share"); + } } } + programDataPath = Path.Combine(programDataPath, "jellyfin"); + var appFolderPath = Path.GetDirectoryName(applicationPath); return new ServerApplicationPaths(programDataPath, appFolderPath, appFolderPath); |
