1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 07:22:35 +01:00

Fixed typo in XDG_CONFIG_HOME handling.

closes #2989
This commit is contained in:
Taloth Saldono 2019-03-12 08:55:01 +01:00
parent 8102cb63ae
commit 0cc2437a9d

View File

@ -132,20 +132,29 @@ namespace NzbDrone.Common.EnvironmentInfo
{ {
if (OsInfo.IsWindows) return; if (OsInfo.IsWindows) return;
var configHome = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); try
if (configHome.EndsWith("/.config") &&! _diskProvider.FolderExists(configHome.GetParentPath()) ||
!_diskProvider.FolderExists(configHome))
{ {
// Tell mono to use appData/.config as ApplicationData folder. var configHome = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
Environment.SetEnvironmentVariable("XDG_CONFIG_HOME", Path.Combine(_appFolderInfo.AppDataFolder, ".config")); if (configHome == "/.config" ||
} configHome.EndsWith("/.config") && !_diskProvider.FolderExists(configHome.GetParentPath()) ||
!_diskProvider.FolderExists(configHome))
{
// Tell mono to use appData/.config as ApplicationData folder.
Environment.SetEnvironmentVariable("XDG_CONFIG_HOME", Path.Combine(_appFolderInfo.AppDataFolder, ".config"));
}
var dataHome = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var dataHome = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
if (dataHome.EndsWith("/.local/share") && !_diskProvider.FolderExists(configHome.GetParentPath().GetParentPath()) || if (dataHome == "/.local/share" ||
!_diskProvider.FolderExists(dataHome)) dataHome.EndsWith("/.local/share") && !_diskProvider.FolderExists(dataHome.GetParentPath().GetParentPath()) ||
!_diskProvider.FolderExists(dataHome))
{
// Tell mono to use appData/.config/share as LocalApplicationData folder.
Environment.SetEnvironmentVariable("XDG_DATA_HOME", Path.Combine(_appFolderInfo.AppDataFolder, ".config/share"));
}
}
catch (Exception ex)
{ {
// Tell mono to use appData/.config/share as LocalApplicationData folder. _logger.Warn(ex, "Failed to initialize the mono config directory.");
Environment.SetEnvironmentVariable("XDG_DATA_HOME", Path.Combine(_appFolderInfo.AppDataFolder, ".config/share"));
} }
} }