diff options
| author | Bond_009 <bond.009@outlook.com> | 2019-01-05 19:12:05 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2019-01-05 20:06:22 +0100 |
| commit | 2850ff7b8afb2ab1a35c2797f88cef1bc0de8bd9 (patch) | |
| tree | bef2f84f7b0b97617fb23ceff68bd1d94c0827ba /Jellyfin.Server/Program.cs | |
| parent | d3b0ba978ced64f61b16c127bc92b47487cb522c (diff) | |
Make config path configurable
Diffstat (limited to 'Jellyfin.Server/Program.cs')
| -rw-r--r-- | Jellyfin.Server/Program.cs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 2dd4d9af6..d8a746304 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -124,6 +124,32 @@ namespace Jellyfin.Server }
}
programDataPath = Path.Combine(programDataPath, "jellyfin");
+ Directory.CreateDirectory(programDataPath);
+ }
+
+ string configPath;
+ if (options.ContainsOption("-configpath"))
+ {
+ configPath = options.GetOption("-configpath");
+ }
+ else
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ configPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
+ }
+ else
+ {
+ // $XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored.
+ configPath = Environment.GetEnvironmentVariable("XDG_CONFIG_HOME");
+ // If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config should be used.
+ if (string.IsNullOrEmpty(configPath))
+ {
+ configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share");
+ }
+ }
+ configPath = Path.Combine(configPath, "jellyfin");
+ Directory.CreateDirectory(configPath);
}
string logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR");
@@ -138,7 +164,7 @@ namespace Jellyfin.Server string appPath = AppContext.BaseDirectory;
- return new ServerApplicationPaths(programDataPath, appPath, appPath, logDir);
+ return new ServerApplicationPaths(programDataPath, appPath, appPath, logDir, configPath);
}
private static async Task createLogger(IApplicationPaths appPaths)
|
