mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #414 from daemitus/fix_devplugin
This commit is contained in:
commit
68142da426
4 changed files with 15 additions and 26 deletions
|
|
@ -85,9 +85,12 @@ namespace Dalamud.Configuration.Internal
|
||||||
public List<string> HiddenPluginInternalName { get; set; } = new();
|
public List<string> HiddenPluginInternalName { get; set; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a list of additional settings for devPlugins.
|
/// Gets or sets a list of additional settings for devPlugins. The key is the absolute path
|
||||||
|
/// to the plugin DLL. This is automatically generated for any plugins in the devPlugins folder.
|
||||||
|
/// However by specifiying this value manually, you can add arbitrary files outside the normal
|
||||||
|
/// file paths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<DevPluginSettings> DevPluginSettings { get; set; } = new();
|
public Dictionary<string, DevPluginSettings> DevPluginSettings { get; set; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the global UI scale.
|
/// Gets or sets the global UI scale.
|
||||||
|
|
|
||||||
|
|
@ -5,21 +5,6 @@ namespace Dalamud.Configuration.Internal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class DevPluginSettings
|
internal sealed class DevPluginSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="DevPluginSettings"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dllFile">Filename of the DLL representing this plugin.</param>
|
|
||||||
public DevPluginSettings(string dllFile)
|
|
||||||
{
|
|
||||||
this.DllFile = dllFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the path to a plugin DLL. This is automatically generated for any plugins in the devPlugins folder. However by
|
|
||||||
/// specifiying this value manually, you can add arbitrary files outside the normal file paths.
|
|
||||||
/// </summary>
|
|
||||||
public string DllFile { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this plugin should automatically start when Dalamud boots up.
|
/// Gets or sets a value indicating whether this plugin should automatically start when Dalamud boots up.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -33,18 +33,12 @@ namespace Dalamud.Plugin.Internal
|
||||||
public LocalDevPlugin(Dalamud dalamud, FileInfo dllFile, LocalPluginManifest manifest)
|
public LocalDevPlugin(Dalamud dalamud, FileInfo dllFile, LocalPluginManifest manifest)
|
||||||
: base(dalamud, dllFile, manifest)
|
: base(dalamud, dllFile, manifest)
|
||||||
{
|
{
|
||||||
// base is called first, ensuring that this is a valid plugin assembly
|
if (!dalamud.Configuration.DevPluginSettings.TryGetValue(dllFile.FullName, out this.devSettings))
|
||||||
var devSettings = dalamud.Configuration.DevPluginSettings.FirstOrDefault(cfg => cfg.DllFile == dllFile.FullName);
|
|
||||||
|
|
||||||
if (devSettings == default)
|
|
||||||
{
|
{
|
||||||
devSettings = new DevPluginSettings(dllFile.FullName);
|
dalamud.Configuration.DevPluginSettings[dllFile.FullName] = this.devSettings = new DevPluginSettings();
|
||||||
dalamud.Configuration.DevPluginSettings.Add(devSettings);
|
|
||||||
dalamud.Configuration.Save();
|
dalamud.Configuration.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.devSettings = devSettings;
|
|
||||||
|
|
||||||
if (this.AutomaticReload)
|
if (this.AutomaticReload)
|
||||||
{
|
{
|
||||||
this.EnableReloading();
|
this.EnableReloading();
|
||||||
|
|
|
||||||
|
|
@ -455,6 +455,10 @@ namespace Dalamud.Plugin.Internal
|
||||||
var devPlugin = new LocalDevPlugin(this.dalamud, dllFile, manifest);
|
var devPlugin = new LocalDevPlugin(this.dalamud, dllFile, manifest);
|
||||||
loadPlugin &= !isBoot || devPlugin.StartOnBoot;
|
loadPlugin &= !isBoot || devPlugin.StartOnBoot;
|
||||||
|
|
||||||
|
// If we're not loading it, make sure it's disabled
|
||||||
|
if (!loadPlugin && !devPlugin.IsDisabled)
|
||||||
|
devPlugin.Disable();
|
||||||
|
|
||||||
plugin = devPlugin;
|
plugin = devPlugin;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -479,14 +483,17 @@ namespace Dalamud.Plugin.Internal
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// Dev plugins always get added to the list so they can be fiddled with in the UI
|
|
||||||
if (plugin.IsDev)
|
if (plugin.IsDev)
|
||||||
{
|
{
|
||||||
|
// Dev plugins always get added to the list so they can be fiddled with in the UI
|
||||||
Log.Information(ex, $"Dev plugin failed to load, adding anyways: {dllFile.Name}");
|
Log.Information(ex, $"Dev plugin failed to load, adding anyways: {dllFile.Name}");
|
||||||
|
plugin.Disable(); // Disable here, otherwise you can't enable+load later
|
||||||
}
|
}
|
||||||
else if (plugin.Manifest.DalamudApiLevel < DalamudApiLevel)
|
else if (plugin.Manifest.DalamudApiLevel < DalamudApiLevel)
|
||||||
{
|
{
|
||||||
|
// Out of date plugins get added so they can be updated.
|
||||||
Log.Information(ex, $"Plugin was outdated, adding anyways: {dllFile.Name}");
|
Log.Information(ex, $"Plugin was outdated, adding anyways: {dllFile.Name}");
|
||||||
|
// plugin.Disable(); // Don't disable, or it gets deleted next boot.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue