From 5251959ac02f0a57d76417a5abfbff680bfab4bf Mon Sep 17 00:00:00 2001 From: Mithun Hunsur Date: Sat, 1 May 2021 16:21:31 +1000 Subject: [PATCH] LPL compatibility --- SamplePlugin/Plugin.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SamplePlugin/Plugin.cs b/SamplePlugin/Plugin.cs index 97827b4..d3d7cb0 100644 --- a/SamplePlugin/Plugin.cs +++ b/SamplePlugin/Plugin.cs @@ -15,6 +15,12 @@ namespace SamplePlugin private DalamudPluginInterface pi; private Configuration configuration; private PluginUI ui; + + // When loaded by LivePluginLoader, the executing assembly will be wrong. + // Supplying this property allows LivePluginLoader to supply the correct location, so that + // you have full compatibility when loaded normally and through LPL. + public string AssemblyLocation { get => assemblyLocation; set => assemblyLocation = value; } + private string assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location; public void Initialize(DalamudPluginInterface pluginInterface) { @@ -24,7 +30,7 @@ namespace SamplePlugin this.configuration.Initialize(this.pi); // you might normally want to embed resources and load them from the manifest stream - var imagePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"goat.png"); + var imagePath = Path.Combine(Path.GetDirectoryName(AssemblyLocation), @"goat.png"); var goatImage = this.pi.UiBuilder.LoadImage(imagePath); this.ui = new PluginUI(this.configuration, goatImage);