Skip to content

Commit 4ecb64e

Browse files
committed
unify some config params, and move datfile location to app data
1 parent 2259feb commit 4ecb64e

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

CompatBot/Config.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,14 @@ internal static class Config
8787
public static string PreferredFontFamily => config.GetValue(nameof(PreferredFontFamily), "");
8888
public static string LogPath => config.GetValue(nameof(LogPath), "./logs/"); // paths are relative to the working directory
8989
public static string IrdCachePath => config.GetValue(nameof(IrdCachePath), "./ird/");
90-
public static string RedumpDatfileCachePath => config.GetValue(nameof(RedumpDatfileCachePath), "./datfile/");
90+
public static string BotAppDataFolder => config.GetValue(
91+
nameof(BotAppDataFolder),
92+
Path.Combine(
93+
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
94+
"compat-bot"
95+
)
96+
);
97+
public static string RedumpDatfileCachePath => Path.Combine(BotAppDataFolder, "compat-bot", "datfile");
9198
public static string RenameNameSuffix => config.GetValue(nameof(RenameNameSuffix), " (Rule 7)");
9299
public static string OcrBackend => config.GetValue(nameof(OcrBackend), "auto"); // possible values: auto, tesseract, florence2, azure
93100

@@ -248,6 +255,7 @@ private static ILogger GetLog()
248255
var fileTarget = new FileTarget("logfile") {
249256
FileName = CurrentLogPath,
250257
ArchiveEvery = FileArchivePeriod.Day,
258+
MaxArchiveDays = 30,
251259
//ArchiveSuffixFormat = ".{1:yyyyMMdd}.{0:00}",
252260
ArchiveNumbering = ArchiveNumberingMode.DateAndSequence,
253261
ConcurrentWrites = false,
@@ -334,4 +342,4 @@ public static async Task GetCurrentGitRevisionAsync(CancellationToken cancellati
334342
var branch = await GitRunner.Exec("rev-parse --abbrev-ref HEAD", cancellationToken);
335343
GitRevision = $"{commit} on {branch}";
336344
}
337-
}
345+
}

CompatBot/Ocr/Backend/BackendBase.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,5 @@ public virtual Task<bool> InitializeAsync(CancellationToken cancellationToken)
2929

3030
public virtual void Dispose() => HttpClient.Dispose();
3131

32-
protected string ModelCachePath => Path.Combine(
33-
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
34-
"discord-bot",
35-
"ocr-models",
36-
Name.ToLowerInvariant()
37-
);
32+
protected string ModelCachePath => Path.Combine(Config.BotAppDataFolder, "ocr-models", Name.ToLowerInvariant());
3833
}

0 commit comments

Comments
 (0)