You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
944 B
34 lines
944 B
using System.IO.Abstractions;
|
|
using JetBrains.Annotations;
|
|
using Recyclarr.Common.Extensions;
|
|
using Recyclarr.Platform;
|
|
using Spectre.Console;
|
|
|
|
namespace Recyclarr.Cli.Migration.Steps;
|
|
|
|
[UsedImplicitly]
|
|
public class DeleteRepoDirMigrationStep(IAppPaths paths) : IMigrationStep
|
|
{
|
|
public int Order => 1;
|
|
public string Description => "Delete old repo directory";
|
|
public IReadOnlyCollection<string> Remediation => new[]
|
|
{
|
|
$"Ensure Recyclarr has permission to recursively delete {RepoDir}",
|
|
$"Delete {RepoDir} manually if Recyclarr can't do it"
|
|
};
|
|
|
|
public bool Required => false;
|
|
private IDirectoryInfo RepoDir => paths.AppDataDirectory.SubDir("repo");
|
|
|
|
public bool CheckIfNeeded()
|
|
{
|
|
return RepoDir.Exists;
|
|
}
|
|
|
|
public void Execute(IAnsiConsole? console)
|
|
{
|
|
RepoDir.RecursivelyDeleteReadOnly();
|
|
console?.WriteLine($"Deleted repo dir: {RepoDir.FullName}");
|
|
}
|
|
}
|