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.
31 lines
1.0 KiB
31 lines
1.0 KiB
using System.Diagnostics.CodeAnalysis;
|
|
using System.IO.Abstractions;
|
|
using TrashLib;
|
|
|
|
namespace Recyclarr;
|
|
|
|
public class AppPaths : IAppPaths
|
|
{
|
|
private readonly IFileSystem _fs;
|
|
private string? _appDataPath;
|
|
|
|
public AppPaths(IFileSystem fs)
|
|
{
|
|
_fs = fs;
|
|
}
|
|
|
|
public string DefaultConfigFilename => "recyclarr.yml";
|
|
|
|
public void SetAppDataPath(string path) => _appDataPath = path;
|
|
|
|
[SuppressMessage("Design", "CA1024:Use properties where appropriate")]
|
|
public string GetAppDataPath()
|
|
=> _appDataPath ?? throw new DirectoryNotFoundException("Application data directory not set!");
|
|
|
|
public string ConfigPath => _fs.Path.Combine(GetAppDataPath(), DefaultConfigFilename);
|
|
public string SettingsPath => _fs.Path.Combine(GetAppDataPath(), "settings.yml");
|
|
public string LogDirectory => _fs.Path.Combine(GetAppDataPath(), "logs");
|
|
public string RepoDirectory => _fs.Path.Combine(GetAppDataPath(), "repo");
|
|
public string CacheDirectory => _fs.Path.Combine(GetAppDataPath(), "cache");
|
|
}
|