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.
recyclarr/src/Recyclarr/Command/Initialization/Init/InitializeAppDataPath.cs

29 lines
870 B

using System.IO.Abstractions;
using TrashLib;
namespace Recyclarr.Command.Initialization.Init;
public class InitializeAppDataPath : IServiceInitializer
{
private readonly IFileSystem _fs;
private readonly IAppPaths _paths;
private readonly IDefaultAppDataSetup _appDataSetup;
public InitializeAppDataPath(IFileSystem fs, IAppPaths paths, IDefaultAppDataSetup appDataSetup)
{
_fs = fs;
_paths = paths;
_appDataSetup = appDataSetup;
}
public void Initialize(ServiceCommand cmd)
{
_appDataSetup.SetupDefaultPath(cmd.AppDataDirectory, true);
// Initialize other directories used throughout the application
_fs.Directory.CreateDirectory(_paths.RepoDirectory);
_fs.Directory.CreateDirectory(_paths.CacheDirectory);
_fs.Directory.CreateDirectory(_paths.LogDirectory);
}
}