mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +01:00
fix: fail gracefully for corrupted manifests
This commit is contained in:
parent
0599b4628b
commit
0ee5843676
1 changed files with 29 additions and 15 deletions
|
|
@ -354,15 +354,22 @@ internal partial class PluginManager : IDisposable, IServiceType
|
||||||
var versionsDefs = new List<PluginDef>();
|
var versionsDefs = new List<PluginDef>();
|
||||||
foreach (var versionDir in pluginDir.GetDirectories())
|
foreach (var versionDir in pluginDir.GetDirectories())
|
||||||
{
|
{
|
||||||
var dllFile = new FileInfo(Path.Combine(versionDir.FullName, $"{pluginDir.Name}.dll"));
|
try
|
||||||
var manifestFile = LocalPluginManifest.GetManifestFile(dllFile);
|
{
|
||||||
|
var dllFile = new FileInfo(Path.Combine(versionDir.FullName, $"{pluginDir.Name}.dll"));
|
||||||
|
var manifestFile = LocalPluginManifest.GetManifestFile(dllFile);
|
||||||
|
|
||||||
if (!manifestFile.Exists)
|
if (!manifestFile.Exists)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var manifest = LocalPluginManifest.Load(manifestFile);
|
var manifest = LocalPluginManifest.Load(manifestFile);
|
||||||
|
|
||||||
versionsDefs.Add(new PluginDef(dllFile, manifest, false));
|
versionsDefs.Add(new PluginDef(dllFile, manifest, false));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Could not load manifest for installed at {Directory}", versionDir.FullName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
@ -395,17 +402,24 @@ internal partial class PluginManager : IDisposable, IServiceType
|
||||||
|
|
||||||
foreach (var dllFile in devDllFiles)
|
foreach (var dllFile in devDllFiles)
|
||||||
{
|
{
|
||||||
// Manifests are not required for devPlugins. the Plugin type will handle any null manifests.
|
try
|
||||||
var manifestFile = LocalPluginManifest.GetManifestFile(dllFile);
|
|
||||||
var manifest = manifestFile.Exists ? LocalPluginManifest.Load(manifestFile) : null;
|
|
||||||
|
|
||||||
if (manifest != null && manifest.InternalName.IsNullOrEmpty())
|
|
||||||
{
|
{
|
||||||
Log.Error("InternalName for dll at {Path} was null", manifestFile.FullName);
|
// Manifests are not required for devPlugins. the Plugin type will handle any null manifests.
|
||||||
continue;
|
var manifestFile = LocalPluginManifest.GetManifestFile(dllFile);
|
||||||
}
|
var manifest = manifestFile.Exists ? LocalPluginManifest.Load(manifestFile) : null;
|
||||||
|
|
||||||
devPluginDefs.Add(new PluginDef(dllFile, manifest, true));
|
if (manifest != null && manifest.InternalName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
Log.Error("InternalName for dll at {Path} was null", manifestFile.FullName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
devPluginDefs.Add(new PluginDef(dllFile, manifest, true));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Could not load manifest for dev at {Directory}", dllFile.FullName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort for load order - unloaded definitions have default priority of 0
|
// Sort for load order - unloaded definitions have default priority of 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue