From 88ce1d96ab7cb9300e91a930185fee086590aa6a Mon Sep 17 00:00:00 2001 From: NinjaLikesCheez Date: Sat, 3 Apr 2021 20:24:41 +0200 Subject: [PATCH] core: Don't perform migrations in cases where the home folder is the same as the jackett install path (#11465) resolves #11313 Additionally, add a guard to not remove config directories unless the migrated directory and initial directory are different paths --- src/Jackett.Common/Services/ConfigurationService.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Jackett.Common/Services/ConfigurationService.cs b/src/Jackett.Common/Services/ConfigurationService.cs index 7d22278cb..d4174e866 100644 --- a/src/Jackett.Common/Services/ConfigurationService.cs +++ b/src/Jackett.Common/Services/ConfigurationService.cs @@ -89,7 +89,12 @@ namespace Jackett.Common.Services // Perform a migration in case of https://github.com/Jackett/Jackett/pull/11173#issuecomment-787520128 if (Environment.OSVersion.Platform == PlatformID.Unix) { - PerformMigration("Jackett"); + // In cases where the app data folder is the same as "$(cwd)/Jackett" we don't need to perform a migration + var fullConfigPath = Path.GetFullPath("Jackett"); + if (GetAppDataFolder() != fullConfigPath) + { + PerformMigration(fullConfigPath); + } } } @@ -128,7 +133,11 @@ namespace Jackett.Common.Services } } } - Directory.Delete(oldDirectory, true); + + // Don't remove configs that have been migrated to the same folder + if (GetAppDataFolder() != oldDirectory) { + Directory.Delete(oldDirectory, true); + } } public T GetConfig()