actually fix devPlugins...

This commit is contained in:
meli 2020-03-04 14:39:38 -08:00
parent 1e3b39b8d9
commit 821bcab17a

View file

@ -101,9 +101,8 @@ namespace Dalamud.Plugin
var defJsonFile = new FileInfo(Path.Combine(dllFile.Directory.FullName, $"{Path.GetFileNameWithoutExtension(dllFile.Name)}.json")); var defJsonFile = new FileInfo(Path.Combine(dllFile.Directory.FullName, $"{Path.GetFileNameWithoutExtension(dllFile.Name)}.json"));
PluginDefinition pluginDef = null; PluginDefinition pluginDef = null;
// load the definition if it exists, even for raw/developer plugins
if (defJsonFile.Exists) if (defJsonFile.Exists)
{
if (!raw)
{ {
Log.Information("Loading definition for plugin DLL {0}", dllFile.FullName); Log.Information("Loading definition for plugin DLL {0}", dllFile.FullName);
@ -117,8 +116,8 @@ namespace Dalamud.Plugin
return false; return false;
} }
} }
} // but developer plugins don't require one to load
else else if (!raw)
{ {
Log.Information("Plugin DLL {0} has no definition.", dllFile.FullName); Log.Information("Plugin DLL {0} has no definition.", dllFile.FullName);
return false; return false;
@ -126,6 +125,21 @@ namespace Dalamud.Plugin
var plugin = (IDalamudPlugin)Activator.CreateInstance(type); var plugin = (IDalamudPlugin)Activator.CreateInstance(type);
// this happens for raw plugins that don't specify a PluginDefinition - just generate a dummy one to avoid crashes anywhere
if (pluginDef == null)
{
pluginDef = new PluginDefinition
{
Author = "developer",
Name = plugin.Name,
InternalName = "devPlugin_" + plugin.Name,
AssemblyVersion = plugin.GetType().Assembly.GetName().Version.ToString(),
Description = "",
ApplicableVersion = "any",
IsHide = false
};
}
var dalamudInterface = new DalamudPluginInterface(this.dalamud, type.Assembly.GetName().Name, this.pluginConfigs); var dalamudInterface = new DalamudPluginInterface(this.dalamud, type.Assembly.GetName().Name, this.pluginConfigs);
plugin.Initialize(dalamudInterface); plugin.Initialize(dalamudInterface);
Log.Information("Loaded plugin: {0}", plugin.Name); Log.Information("Loaded plugin: {0}", plugin.Name);