feat(util): add IPlatformUtil indirection over Dalamud.Utility.Util (F12.1)
Introduces a thin interface around Util.IsWine and Util.OpenLink so services can be constructed in an isolated xUnit AppDomain without forcing Dalamud.dll onto the assembly search path. Production wiring (DalamudPlatformUtil) caches IsWine at ctor time — it's a runtime probe that never changes for the lifetime of a plugin instance, mirroring the Lightless DalamudUtilService pattern. Plugin.PlatformUtil is wired in the Phase-1 ctor so any service that LoadAsync allocates can resolve the platform indirection without plumbing the instance through additional constructor params. Follow-up commits route MessageStore and the OpenLink call-sites through this interface.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
namespace HellionChat.Util;
|
||||
|
||||
internal sealed class DalamudPlatformUtil : IPlatformUtil
|
||||
{
|
||||
public DalamudPlatformUtil()
|
||||
{
|
||||
// Util.IsWine probes the host process and never changes for the
|
||||
// lifetime of a plugin instance, so we cache it once at ctor.
|
||||
// Mirrors LightlessSync/Services/DalamudUtilService:154.
|
||||
IsWine = Dalamud.Utility.Util.IsWine();
|
||||
}
|
||||
|
||||
public bool IsWine { get; }
|
||||
|
||||
public void OpenLink(string url) => Dalamud.Utility.Util.OpenLink(url);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace HellionChat.Util;
|
||||
|
||||
// Indirection over Dalamud.Utility.Util's static surface so services can be
|
||||
// constructed in an isolated xUnit AppDomain without loading Dalamud.dll.
|
||||
// Production wiring lives in DalamudPlatformUtil; tests substitute a fake.
|
||||
internal interface IPlatformUtil
|
||||
{
|
||||
bool IsWine { get; }
|
||||
|
||||
void OpenLink(string url);
|
||||
}
|
||||
Reference in New Issue
Block a user