BaseApplicationPaths set up default config and log dir paths
This commit is contained in:
parent
b27315bc08
commit
5623d4b632
|
@ -47,6 +47,8 @@ namespace Jellyfin.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
await createLogger(appPaths);
|
||||||
_loggerFactory = new SerilogLoggerFactory();
|
_loggerFactory = new SerilogLoggerFactory();
|
||||||
_logger = _loggerFactory.CreateLogger("Main");
|
_logger = _loggerFactory.CreateLogger("Main");
|
||||||
|
@ -140,23 +142,8 @@ namespace Jellyfin.Server
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
// Let BaseApplicationPaths set up the default value
|
||||||
{
|
configDir = null;
|
||||||
configDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// $XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored.
|
|
||||||
configDir = Environment.GetEnvironmentVariable("XDG_CONFIG_HOME");
|
|
||||||
// If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config should be used.
|
|
||||||
if (string.IsNullOrEmpty(configDir))
|
|
||||||
{
|
|
||||||
configDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
configDir = Path.Combine(configDir, "jellyfin");
|
|
||||||
// Ensure the dir exists
|
|
||||||
Directory.CreateDirectory(configDir);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,12 +156,9 @@ namespace Jellyfin.Server
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logDir = Path.Combine(programDataPath, "logs");
|
// Let BaseApplicationPaths set up the default value
|
||||||
// Ensure the dir exists
|
logDir = null;
|
||||||
Directory.CreateDirectory(logDir);
|
|
||||||
}
|
}
|
||||||
// $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager
|
|
||||||
Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", logDir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string appPath = AppContext.BaseDirectory;
|
string appPath = AppContext.BaseDirectory;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user