Use -logdir if env var isn't set

This commit is contained in:
Bond_009 2019-01-05 21:11:55 +01:00
parent 2850ff7b8a
commit 23267bb08f

View File

@ -124,13 +124,14 @@ namespace Jellyfin.Server
} }
} }
programDataPath = Path.Combine(programDataPath, "jellyfin"); programDataPath = Path.Combine(programDataPath, "jellyfin");
// Ensure the dir exists
Directory.CreateDirectory(programDataPath); Directory.CreateDirectory(programDataPath);
} }
string configPath; string configPath;
if (options.ContainsOption("-configpath")) if (options.ContainsOption("-configdir"))
{ {
configPath = options.GetOption("-configpath"); configPath = options.GetOption("-configdir");
} }
else else
{ {
@ -149,15 +150,23 @@ namespace Jellyfin.Server
} }
} }
configPath = Path.Combine(configPath, "jellyfin"); configPath = Path.Combine(configPath, "jellyfin");
// Ensure the dir exists
Directory.CreateDirectory(configPath); Directory.CreateDirectory(configPath);
} }
string logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR"); string logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR");
if (string.IsNullOrEmpty(logDir)) if (string.IsNullOrEmpty(logDir))
{ {
logDir = Path.Combine(programDataPath, "logs"); if (options.ContainsOption("-logdir"))
// Ensure logDir exists {
Directory.CreateDirectory(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 // $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager
Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", logDir); Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", logDir);
} }