Fix some log creation issues and tests

This commit is contained in:
Halgari 2022-10-06 16:54:01 -06:00
parent 46a24d9268
commit 558886e0ed
4 changed files with 19 additions and 2 deletions

View File

@ -50,7 +50,10 @@ namespace Wabbajack
{
var config = new NLog.Config.LoggingConfiguration();
var logFolder = KnownFolders.LauncherAwarePath;
var logFolder = KnownFolders.LauncherAwarePath.Combine("logs");
if (!logFolder.DirectoryExists())
logFolder.CreateDirectory();
var fileTarget = new FileTarget("file")
{
FileName = logFolder.Combine("Wabbajack.current.log").ToString(),

View File

@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Wabbajack.DTOs.Interventions;
using Wabbajack.Services.OSIntegrated;
using Xunit.DependencyInjection;
using Xunit.DependencyInjection.Logging;
@ -10,6 +11,7 @@ public class Startup
{
public void ConfigureServices(IServiceCollection service)
{
service.AddSingleton<IUserInterventionHandler, ThrowingUserInterventionHandler>();
service.AddOSIntegrated(o =>
{
o.UseLocalCache = true;

View File

@ -90,7 +90,7 @@ public static class ServiceExtensions
EncryptedDataLocation = KnownFolders.WabbajackAppLocal.Combine("encrypted"),
ModListsDownloadLocation = KnownFolders.EntryPoint.Combine("downloaded_mod_lists"),
SavedSettingsLocation = KnownFolders.WabbajackAppLocal.Combine("saved_settings"),
LogLocation = KnownFolders.EntryPoint.Combine("logs"),
LogLocation = KnownFolders.LauncherAwarePath.Combine("logs"),
ImageCacheLocation = KnownFolders.WabbajackAppLocal.Combine("image_cache")
});

View File

@ -0,0 +1,12 @@
using System;
using Wabbajack.DTOs.Interventions;
namespace Wabbajack.Services.OSIntegrated;
public class ThrowingUserInterventionHandler : IUserInterventionHandler
{
public void Raise(IUserIntervention intervention)
{
throw new Exception("Unexpected user intervention, this should throw");
}
}