mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-25 17:27:18 +00:00
app data is now stored in /var/[USER]/.config/ folder in *nix
This commit is contained in:
parent
f55e4e4a54
commit
59f8e3046e
1 changed files with 9 additions and 20 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue