diff options
| author | Erwin de Haan <EraYaN@users.noreply.github.com> | 2019-01-19 14:45:02 +0100 |
|---|---|---|
| committer | Erwin de Haan <EraYaN@users.noreply.github.com> | 2019-01-19 14:45:02 +0100 |
| commit | 1e9402392781567ad73f0b1fae01c17989278ff6 (patch) | |
| tree | d6c780654d3b9258c99b463f86e4764d88928d32 /Jellyfin.Server/Program.cs | |
| parent | e63b18f17d3938a6c0848c1978c1290a86daa70f (diff) | |
| parent | a00c0defa8cb22774f5dc8a7d566eb36ac7307e8 (diff) | |
Merge branch 'dev' into reformat
Diffstat (limited to 'Jellyfin.Server/Program.cs')
| -rw-r--r-- | Jellyfin.Server/Program.cs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index a36e652d4..51ad53749 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -45,7 +45,8 @@ namespace Jellyfin.Server Console.WriteLine(version.ToString()); } - ServerApplicationPaths appPaths = createApplicationPaths(options); + ServerApplicationPaths appPaths = CreateApplicationPaths(options); + // $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", appPaths.LogDirectoryPath); await createLogger(appPaths); @@ -130,7 +131,7 @@ namespace Jellyfin.Server } } - private static ServerApplicationPaths createApplicationPaths(StartupOptions options) + private static ServerApplicationPaths CreateApplicationPaths(StartupOptions options) { string programDataPath = Environment.GetEnvironmentVariable("JELLYFIN_DATA_PATH"); if (string.IsNullOrEmpty(programDataPath)) @@ -155,12 +156,21 @@ namespace Jellyfin.Server programDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share"); } } + programDataPath = Path.Combine(programDataPath, "jellyfin"); - // Ensure the dir exists - Directory.CreateDirectory(programDataPath); } } + if (string.IsNullOrEmpty(programDataPath)) + { + Console.WriteLine("Cannot continue without path to program data folder (try -programdata)"); + Environment.Exit(1); + } + else + { + Directory.CreateDirectory(programDataPath); + } + string configDir = Environment.GetEnvironmentVariable("JELLYFIN_CONFIG_DIR"); if (string.IsNullOrEmpty(configDir)) { @@ -175,6 +185,11 @@ namespace Jellyfin.Server } } + if (configDir != null) + { + Directory.CreateDirectory(configDir); + } + string logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR"); if (string.IsNullOrEmpty(logDir)) { @@ -189,6 +204,11 @@ namespace Jellyfin.Server } } + if (logDir != null) + { + Directory.CreateDirectory(logDir); + } + string appPath = AppContext.BaseDirectory; return new ServerApplicationPaths(programDataPath, appPath, appPath, logDir, configDir); |
