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
This commit is contained in:
NinjaLikesCheez 2021-04-03 20:24:41 +02:00 committed by GitHub
parent 238e46b4a1
commit 88ce1d96ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -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<T>()