From 4d6d9d5cd7ff3be7f99f828ba586454e8684a510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20Ko=C5=BEelj?= Date: Mon, 6 Feb 2023 13:45:06 +0100 Subject: [PATCH] Fix dependency loader to properly handle relative local repositories Fix .csproj to not include default configuration in nuget package --- src/Connected.Host/Connected.Host.csproj | 3 +++ src/Connected.Host/DependencyLoader.cs | 28 +++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Connected.Host/Connected.Host.csproj b/src/Connected.Host/Connected.Host.csproj index 587fc29..133b95e 100644 --- a/src/Connected.Host/Connected.Host.csproj +++ b/src/Connected.Host/Connected.Host.csproj @@ -44,6 +44,9 @@ True \ + + false + diff --git a/src/Connected.Host/DependencyLoader.cs b/src/Connected.Host/DependencyLoader.cs index 26881fa..d27b7b6 100644 --- a/src/Connected.Host/DependencyLoader.cs +++ b/src/Connected.Host/DependencyLoader.cs @@ -159,7 +159,33 @@ public class DependencyLoader private IEnumerable GetPackageSources(IEnumerable sources) { foreach (var source in sources) - yield return new PackageSource(source); + { + var packageSource = new PackageSource(source); + + if (Uri.TryCreate(source, UriKind.RelativeOrAbsolute, out var sourceUri)) + { + if (!sourceUri.IsAbsoluteUri) + packageSource = new PackageSource(Path.GetFullPath(source)); + } + + //if (packageSource.IsLocal || packageSource.TrySourceAsUri is null) + //{ + // /* + // * Suspected local, verify + // */ + // var local = Directory.Exists(source); + // if (local) + // { + // /* + // * If it's a cache, add all folders to sources + // */ + // foreach (var directorySource in GetPackageSources(Directory.GetDirectories(source))) + // yield return directorySource; + // } + //} + + yield return packageSource; + } } ///