using Avalonia; using System.IO; using System.Reflection; using System.Threading.Tasks; using VeloeAvaloniaKemonoPartyApp.Services; namespace VeloeAvaloniaKemonoPartyApp.Desktop.Services { public class DesktopStorageService : IStorageService { private string _cacheFolder; public DesktopStorageService() { _cacheFolder = Directory.GetParent(Assembly.GetEntryAssembly().Location) + "/cache/"; if (!Directory.Exists(_cacheFolder)) Directory.CreateDirectory(_cacheFolder); } public async Task GetCacheFolderAsync() { return await Task.FromResult(_cacheFolder); } } public static class DesktopStorageServiceAppBuilderExtentions { public static AppBuilder InitStorageService(this AppBuilder appBuilder) { RegisteredServices.StorageService = new DesktopStorageService(); return appBuilder; } } }