mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 18:20:47 +01:00
feat: use %appdata% for kv store
This commit is contained in:
@@ -115,8 +115,12 @@ class Program
|
|||||||
builder.AddSingleton<GithubService>();
|
builder.AddSingleton<GithubService>();
|
||||||
builder.AddSingleton<IBlobCache>((_) =>
|
builder.AddSingleton<IBlobCache>((_) =>
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory("Data");
|
var appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||||
return new SqlRawPersistentBlobCache("Data/data.sqlite");
|
appDataFolder = string.IsNullOrEmpty(appDataFolder) ? "AppData" : appDataFolder;
|
||||||
|
var appFolder = Path.Join(appDataFolder, AppInfo.Name);
|
||||||
|
Directory.CreateDirectory(appFolder);
|
||||||
|
var filePath = Path.Join(appFolder, "cache.sqlite");
|
||||||
|
return new SqlRawPersistentBlobCache(filePath);
|
||||||
});
|
});
|
||||||
builder.AddSingleton<IFlurlClientCache>(new FlurlClientCache()
|
builder.AddSingleton<IFlurlClientCache>(new FlurlClientCache()
|
||||||
.Add(FlurlClientKeys.GithubClient, "https://api.github.com")
|
.Add(FlurlClientKeys.GithubClient, "https://api.github.com")
|
||||||
|
|||||||
Reference in New Issue
Block a user