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

pull/4/head
kay.one 12 years ago
parent f55e4e4a54
commit 59f8e3046e

@ -17,35 +17,24 @@ 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");
StartUpFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
TempFolder = Path.GetTempPath();
if (!_diskProvider.FolderExists(AppDataFolder)) if (OsInfo.IsLinux)
{ {
MigrateFromAppData(); _dataSpecialFolder = Environment.SpecialFolder.ApplicationData;
} }
SetPermissions(); AppDataFolder = Path.Combine(Environment.GetFolderPath(_dataSpecialFolder, Environment.SpecialFolderOption.DoNotVerify), "NzbDrone");
} StartUpFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
TempFolder = Path.GetTempPath();
private void MigrateFromAppData()
{
var oldAppDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.DoNotVerify), "NzbDrone");
if (_diskProvider.FolderExists(oldAppDataFolder)) SetPermissions();
{
_diskProvider.MoveFolder(oldAppDataFolder, AppDataFolder);
}
else
{
_diskProvider.CreateFolder(AppDataFolder);
}
} }
private void SetPermissions() private void SetPermissions()

Loading…
Cancel
Save