1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 01:37:07 +00:00

app data is now stored in /var/[USER]/.config/ folder in *nix

This commit is contained in:
kay.one 2013-07-25 23:48:35 -07:00
parent f55e4e4a54
commit 59f8e3046e

View file

@ -17,37 +17,26 @@ namespace NzbDrone.Common.EnvironmentInfo
{ {
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
private readonly Logger _logger; private readonly Logger _logger;
private readonly Environment.SpecialFolder _dataSpecialFolder = Environment.SpecialFolder.CommonApplicationData;
public AppFolderInfo(IDiskProvider diskProvider) public AppFolderInfo(IDiskProvider diskProvider)
{ {
_diskProvider = diskProvider; _diskProvider = diskProvider;
_logger = LogManager.GetCurrentClassLogger(); _logger = LogManager.GetCurrentClassLogger();
AppDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData, Environment.SpecialFolderOption.DoNotVerify), "NzbDrone");
if (OsInfo.IsLinux)
{
_dataSpecialFolder = Environment.SpecialFolder.ApplicationData;
}
AppDataFolder = Path.Combine(Environment.GetFolderPath(_dataSpecialFolder, Environment.SpecialFolderOption.DoNotVerify), "NzbDrone");
StartUpFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName; StartUpFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
TempFolder = Path.GetTempPath(); TempFolder = Path.GetTempPath();
if (!_diskProvider.FolderExists(AppDataFolder))
{
MigrateFromAppData();
}
SetPermissions(); SetPermissions();
} }
private void MigrateFromAppData()
{
var oldAppDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.DoNotVerify), "NzbDrone");
if (_diskProvider.FolderExists(oldAppDataFolder))
{
_diskProvider.MoveFolder(oldAppDataFolder, AppDataFolder);
}
else
{
_diskProvider.CreateFolder(AppDataFolder);
}
}
private void SetPermissions() private void SetPermissions()
{ {
try try