aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Mono/Program.cs
diff options
context:
space:
mode:
authorAndrew Rabert <6550543+nvllsvm@users.noreply.github.com>2018-12-14 21:28:12 -0500
committerGitHub <noreply@github.com>2018-12-14 21:28:12 -0500
commit46c75d75bd8702da4d3728c11f28756a9c9abb72 (patch)
treedd6a198e3c104ebc732a615153c4bb5514e25660 /MediaBrowser.Server.Mono/Program.cs
parentb36b526f27ebd9ac716d743eea26e65407ceeea4 (diff)
parenta73d255f51f135adbc2c352fef79f776ce9fcb02 (diff)
Merge pull request #166 from jellyfin/develop
Develop
Diffstat (limited to 'MediaBrowser.Server.Mono/Program.cs')
-rw-r--r--MediaBrowser.Server.Mono/Program.cs18
1 files changed, 16 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs
index 3bcfff983..887a9545f 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,25 @@ 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)