diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2018-12-13 18:44:39 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-13 18:44:39 -0500 |
| commit | bdc2655a78e3162b7983ab12ed113cedccf55408 (patch) | |
| tree | 990e3e53fcf3f5c69f8ee000ea2bae1623b98e80 /MediaBrowser.Server.Mono/Program.cs | |
| parent | 64805410c21b1e4717a7f030f619bb2e7bd33d2a (diff) | |
| parent | b79f6e4ba0c2aa761b2fe016ca531dfdf6273b0e (diff) | |
Merge pull request #97 from Bond-009/home
Move default data folder for *nix platforms to $XDG_DATA_HOME/jellyfin
Diffstat (limited to 'MediaBrowser.Server.Mono/Program.cs')
| -rw-r--r-- | MediaBrowser.Server.Mono/Program.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 3bcfff983..21de06ccc 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -24,6 +24,7 @@ using Mono.Unix.Native; using ILogger = MediaBrowser.Model.Logging.ILogger; using X509Certificate = System.Security.Cryptography.X509Certificates.X509Certificate; using System.Threading; +using InteropServices = System.Runtime.InteropServices; namespace MediaBrowser.Server.Mono { @@ -87,12 +88,26 @@ namespace MediaBrowser.Server.Mono { if (string.IsNullOrEmpty(programDataPath)) { - programDataPath = ApplicationPathHelper.GetProgramDataPath(applicationPath); + if (InteropServices.RuntimeInformation.IsOSPlatform(InteropServices.OSPlatform.Windows)) + { + programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + } + else + { + // $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, Path.GetDirectoryName(applicationPath)); + return new ServerApplicationPaths(programDataPath, appFolderPath, appFolderPath); } private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, StartupOptions options) |
