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,8 +132,11 @@ namespace NzbDrone.Common.EnvironmentInfo
{ {
if (OsInfo.IsWindows) return; if (OsInfo.IsWindows) return;
try
{
var configHome = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); var configHome = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
if (configHome.EndsWith("/.config") &&! _diskProvider.FolderExists(configHome.GetParentPath()) || if (configHome == "/.config" ||
configHome.EndsWith("/.config") && !_diskProvider.FolderExists(configHome.GetParentPath()) ||
!_diskProvider.FolderExists(configHome)) !_diskProvider.FolderExists(configHome))
{ {
// Tell mono to use appData/.config as ApplicationData folder. // Tell mono to use appData/.config as ApplicationData folder.
@ -141,13 +144,19 @@ namespace NzbDrone.Common.EnvironmentInfo
} }
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" ||
dataHome.EndsWith("/.local/share") && !_diskProvider.FolderExists(dataHome.GetParentPath().GetParentPath()) ||
!_diskProvider.FolderExists(dataHome)) !_diskProvider.FolderExists(dataHome))
{ {
// Tell mono to use appData/.config/share as LocalApplicationData folder. // Tell mono to use appData/.config/share as LocalApplicationData folder.
Environment.SetEnvironmentVariable("XDG_DATA_HOME", Path.Combine(_appFolderInfo.AppDataFolder, ".config/share")); Environment.SetEnvironmentVariable("XDG_DATA_HOME", Path.Combine(_appFolderInfo.AppDataFolder, ".config/share"));
} }
} }
catch (Exception ex)
{
_logger.Warn(ex, "Failed to initialize the mono config directory.");
}
}
private void CleanupSqLiteRollbackFiles() private void CleanupSqLiteRollbackFiles()
{ {