From 179895dee0a052d025f8223871ca3f98f8debb76 Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Sun, 7 Jul 2024 15:36:29 -0500 Subject: [PATCH] Fix loading in IrisSourceRepository --- UIXC/IrisSourceRepository.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/UIXC/IrisSourceRepository.cs b/UIXC/IrisSourceRepository.cs index 53d5ec1..fa4051f 100644 --- a/UIXC/IrisSourceRepository.cs +++ b/UIXC/IrisSourceRepository.cs @@ -14,6 +14,11 @@ internal class IrisSourceRepository : ISourceRepository foreach (var compiland in compilands) { var id = compiland.SourceFileName; + + // We can only read source from local files + if (id.Contains(Uri.SchemeDelimiter)) + continue; + _sourceCache.Add(id, null); } @@ -21,10 +26,13 @@ internal class IrisSourceRepository : ISourceRepository _sourceCache.Add(sharedBinaryDataTable.Value.SourceFileName, null); } - public bool TryGet(string id, [NotNullWhen(true)] out Source? source) + public bool TryGet(string uri, [NotNullWhen(true)] out Source? source) { + var idStart = uri.IndexOf(Uri.SchemeDelimiter) + Uri.SchemeDelimiter.Length; + var id = uri[idStart..]; + if (!_sourceCache.TryGetValue(id, out source)) - throw new ArgumentException($"No compiland with ID '{id}' was loaded."); + return false; if (source is null) {