mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
app data is now stored in /var/[USER]/.config/ folder in *nix
This commit is contained in:
parent
f55e4e4a54
commit
59f8e3046e
@ -17,37 +17,26 @@ public class AppFolderInfo : IAppFolderInfo
|
||||
{
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly Logger _logger;
|
||||
private readonly Environment.SpecialFolder _dataSpecialFolder = Environment.SpecialFolder.CommonApplicationData;
|
||||
|
||||
|
||||
public AppFolderInfo(IDiskProvider diskProvider)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_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;
|
||||
TempFolder = Path.GetTempPath();
|
||||
|
||||
if (!_diskProvider.FolderExists(AppDataFolder))
|
||||
{
|
||||
MigrateFromAppData();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user