From ed4fd11de0e9c5600958e3ddffe49b09eefd0001 Mon Sep 17 00:00:00 2001 From: pas2704 Date: Sun, 3 Nov 2024 16:44:42 -0500 Subject: [PATCH] Speed up loading by checking for existing dependency manifest --- CringePlugins/Loader/PluginsLifetime.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CringePlugins/Loader/PluginsLifetime.cs b/CringePlugins/Loader/PluginsLifetime.cs index 6e3221e..c6afe82 100644 --- a/CringePlugins/Loader/PluginsLifetime.cs +++ b/CringePlugins/Loader/PluginsLifetime.cs @@ -106,8 +106,13 @@ public class PluginsLifetime : ILoadingStage { var dir = Path.Join(package.Directory.FullName, "lib", package.ResolvedFramework.GetShortFolderName()); - await using (var stream = File.Create(Path.Join(dir, $"{package.Package.Id}.deps.json"))) - await manifestBuilder.WriteDependencyManifestAsync(stream, package.Entry, _runtimeFramework); + var path = Path.Join(dir, $"{package.Package.Id}.deps.json"); + if (!File.Exists(path)) + { + await using (var stream = File.Create(path)) + await manifestBuilder.WriteDependencyManifestAsync(stream, package.Entry, _runtimeFramework); + } + var client = await sourceMapping.GetClientAsync(package.Package.Id); var sourceName = packagesConfig.Sources.First(b => b.Url == client.ToString()).Name;