aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Program.cs
diff options
context:
space:
mode:
authorVasily <JustAMan@users.noreply.github.com>2019-02-20 14:31:01 +0300
committerGitHub <noreply@github.com>2019-02-20 14:31:01 +0300
commit50ce7572b471f57150519e24bec61548739bf255 (patch)
tree0c4d226fc867d670d8a8c77481517d96c909d4ab /Jellyfin.Server/Program.cs
parent74695428fe91f609edf063e98eb621d140b3a8f9 (diff)
parent51ba28bd651079eb4f704739dcb17852537ddf55 (diff)
Merge pull request #851 from Bond-009/appdata
Simplify code to get data dir
Diffstat (limited to 'Jellyfin.Server/Program.cs')
-rw-r--r--Jellyfin.Server/Program.cs23
1 files changed, 4 insertions, 19 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 2a2f1dde6..41ee73a56 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -187,26 +187,13 @@ namespace Jellyfin.Server
if (string.IsNullOrEmpty(dataDir))
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- dataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
- }
- else
- {
- // $XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored.
- dataDir = Environment.GetEnvironmentVariable("XDG_DATA_HOME");
-
- // If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.
- if (string.IsNullOrEmpty(dataDir))
- {
- dataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share");
- }
- }
-
- dataDir = Path.Combine(dataDir, "jellyfin");
+ // LocalApplicationData follows the XDG spec on unix machines
+ dataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "jellyfin");
}
}
+ Directory.CreateDirectory(dataDir);
+
// configDir
// IF --configdir
// ELSE IF $JELLYFIN_CONFIG_DIR
@@ -216,7 +203,6 @@ namespace Jellyfin.Server
// ELSE IF $XDG_CONFIG_HOME use $XDG_CONFIG_HOME/jellyfin
// ELSE $HOME/.config/jellyfin
var configDir = options.ConfigDir;
-
if (string.IsNullOrEmpty(configDir))
{
configDir = Environment.GetEnvironmentVariable("JELLYFIN_CONFIG_DIR");
@@ -300,7 +286,6 @@ namespace Jellyfin.Server
// Ensure the main folders exist before we continue
try
{
- Directory.CreateDirectory(dataDir);
Directory.CreateDirectory(logDir);
Directory.CreateDirectory(configDir);
Directory.CreateDirectory(cacheDir);