From 23267bb08f7dcc319c81cdbdaa68efb0c6ea5bc7 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sat, 5 Jan 2019 21:11:55 +0100 Subject: [PATCH] Use -logdir if env var isn't set --- Jellyfin.Server/Program.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index d8a7463043..53eaacad09 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -124,13 +124,14 @@ namespace Jellyfin.Server } } programDataPath = Path.Combine(programDataPath, "jellyfin"); + // Ensure the dir exists Directory.CreateDirectory(programDataPath); } string configPath; - if (options.ContainsOption("-configpath")) + if (options.ContainsOption("-configdir")) { - configPath = options.GetOption("-configpath"); + configPath = options.GetOption("-configdir"); } else { @@ -149,15 +150,23 @@ namespace Jellyfin.Server } } configPath = Path.Combine(configPath, "jellyfin"); + // Ensure the dir exists Directory.CreateDirectory(configPath); } string logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR"); if (string.IsNullOrEmpty(logDir)) { - logDir = Path.Combine(programDataPath, "logs"); - // Ensure logDir exists - Directory.CreateDirectory(logDir); + if (options.ContainsOption("-logdir")) + { + logDir = options.GetOption("-logdir"); + } + else + { + logDir = Path.Combine(programDataPath, "logs"); + // Ensure the dir exists + Directory.CreateDirectory(logDir); + } // $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", logDir); }