mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #63 from ff-meli/plugin_dependency_loading
Fix for the change to Assembly.LoadFile() no longer correctly handling plugin's local dll dependencies
This commit is contained in:
commit
9b39db6940
1 changed files with 16 additions and 0 deletions
|
|
@ -26,6 +26,22 @@ namespace Dalamud.Plugin
|
|||
this.devPluginDirectory = devPluginDirectory;
|
||||
|
||||
this.pluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(dalamud.StartInfo.ConfigurationPath), "pluginConfigs"));
|
||||
|
||||
// Try to load missing assemblies from the local directory of the requesting assembly
|
||||
// This would usually be implicit when using Assembly.Load(), but Assembly.LoadFile() doesn't do it...
|
||||
// This handler should only be invoked on things that fail regular lookups, but it *is* global to this appdomain
|
||||
AppDomain.CurrentDomain.AssemblyResolve += (object source, ResolveEventArgs e) =>
|
||||
{
|
||||
Log.Debug($"Resolving missing assembly {e.Name}");
|
||||
// This looks weird but I'm pretty sure it's actually correct. Pretty sure. Probably.
|
||||
var assemblyPath = Path.Combine(Path.GetDirectoryName(e.RequestingAssembly.Location), new AssemblyName(e.Name).Name + ".dll");
|
||||
if (!File.Exists(assemblyPath))
|
||||
{
|
||||
Log.Error($"Assembly not found at {assemblyPath}");
|
||||
return null;
|
||||
}
|
||||
return Assembly.LoadFrom(assemblyPath);
|
||||
};
|
||||
}
|
||||
|
||||
public void UnloadPlugins() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue