diff options
| author | Claus Vium <cvium@users.noreply.github.com> | 2020-12-04 14:10:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-04 14:10:31 +0100 |
| commit | 8b697060dda902acbf09a9ebd8946f45f461b62f (patch) | |
| tree | 5be2338b7ec18013fb18feb3325d3228b3e5da59 | |
| parent | 9afd19b06e025992ee5159a08d7af8bd736a828e (diff) | |
| parent | dca3f62ff85ba62af95831848718e9764d163306 (diff) | |
Merge pull request #4522 from BaronGreenback/PlugsVersionNumberFix
Set plugin version to that specified in the manifest
| -rw-r--r-- | Emby.Server.Implementations/ApplicationHost.cs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 37d6f9db4..43e5198ed 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -183,6 +183,8 @@ namespace Emby.Server.Implementations private IPlugin[] _plugins; + private IReadOnlyList<LocalPlugin> _pluginsManifests; + /// <summary> /// Gets the plugins. /// </summary> @@ -776,6 +778,23 @@ namespace Emby.Server.Implementations { foreach (var plugin in Plugins) { + if (_pluginsManifests != null && plugin is IPluginAssembly assemblyPlugin) + { + // Ensure the version number matches the Plugin Manifest information. + foreach (var item in _pluginsManifests) + { + if (Path.GetDirectoryName(plugin.AssemblyFilePath).Equals(item.Path, StringComparison.OrdinalIgnoreCase)) + { + // Update version number to that of the manifest. + assemblyPlugin.SetAttributes( + plugin.AssemblyFilePath, + Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(plugin.AssemblyFilePath)), + item.Version); + break; + } + } + } + Logger.LogInformation("Loaded plugin: {PluginName} {PluginVersion}", plugin.Name, plugin.Version); } } @@ -1093,7 +1112,8 @@ namespace Emby.Server.Implementations { if (Directory.Exists(ApplicationPaths.PluginsPath)) { - foreach (var plugin in GetLocalPlugins(ApplicationPaths.PluginsPath)) + _pluginsManifests = GetLocalPlugins(ApplicationPaths.PluginsPath).ToList(); + foreach (var plugin in _pluginsManifests) { foreach (var file in plugin.DllFiles) { |
