The Free Software Media System - Server Backend & API
Fix bad merge
crobiberodbfbf9fb5bc7
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex 9d4643fcf5..094134318c 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -1026,102 +1026,6 @@ namespace Emby.Server.Implementationsprotected abstract void RestartInternal();- /// <inheritdoc/>- public IEnumerable<LocalPlugin> GetLocalPlugins(string path, bool cleanup = true)- {- var minimumVersion = new Version(0, 0, 0, 1);- var versions = new List<LocalPlugin>();- if (!Directory.Exists(path))- {- // Plugin path doesn't exist, don't try to enumerate subfolders.- return Enumerable.Empty<LocalPlugin>();- }-- var directories = Directory.EnumerateDirectories(path, "*.*", SearchOption.TopDirectoryOnly);-- foreach (var dir in directories)- {- try- {- var metafile = Path.Combine(dir, "meta.json");- if (File.Exists(metafile))- {- var jsonString = File.ReadAllText(metafile, Encoding.UTF8);- var manifest = JsonSerializer.Deserialize<PluginManifest>(jsonString, _jsonOptions);-- if (!Version.TryParse(manifest.TargetAbi, out var targetAbi))- {- targetAbi = minimumVersion;- }-- if (!Version.TryParse(manifest.Version, out var version))- {- version = minimumVersion;- }-- if (ApplicationVersion >= targetAbi)- {- // Only load Plugins if the plugin is built for this version or below.- versions.Add(new LocalPlugin(manifest.Guid, manifest.Name, version, dir));- }- }- else- {- // No metafile, so lets see if the folder is versioned.- metafile = dir.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries)[^1];-- int versionIndex = dir.LastIndexOf('_');- if (versionIndex != -1 && Version.TryParse(dir.AsSpan()[(versionIndex + 1)..], out Version parsedVersion))- {- // Versioned folder.- versions.Add(new LocalPlugin(Guid.Empty, metafile, parsedVersion, dir));- }- else- {- // Un-versioned folder - Add it under the path name and version 0.0.0.1.- versions.Add(new LocalPlugin(Guid.Empty, metafile, minimumVersion, dir));- }- }- }- catch- {- continue;- }- }-- string lastName = string.Empty;- versions.Sort(LocalPlugin.Compare);- // Traverse backwards through the list.- // The first item will be the latest version.- for (int x = versions.Count - 1; x >= 0; x--)- {- if (!string.Equals(lastName, versions[x].Name, StringComparison.OrdinalIgnoreCase))- {- versions[x].DllFiles.AddRange(Directory.EnumerateFiles(versions[x].Path, "*.dll", SearchOption.AllDirectories));- lastName = versions[x].Name;- continue;- }-- if (!string.IsNullOrEmpty(lastName) && cleanup)- {- // Attempt a cleanup of old folders.- try- {- Logger.LogDebug("Deleting {Path}", versions[x].Path);- Directory.Delete(versions[x].Path, true);- }- catch (Exception e)- {- Logger.LogWarning(e, "Unable to delete {Path}", versions[x].Path);- }-- versions.RemoveAt(x);- }- }-- return versions;- }-/// <summary>/// Gets the composable part assemblies./// </summary>