From 777001f3a9ea3e6616a859201a8473c9f68116fe Mon Sep 17 00:00:00 2001 From: Andrew Payne Date: Mon, 28 Oct 2024 16:42:54 -0400 Subject: [PATCH] testing changes for Compute-298 --- src/hops/HopsComponent.cs | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/hops/HopsComponent.cs b/src/hops/HopsComponent.cs index 25ef871c..2aabec5d 100644 --- a/src/hops/HopsComponent.cs +++ b/src/hops/HopsComponent.cs @@ -365,24 +365,18 @@ public override bool Read(GH_IReader reader) var pathType = RemoteDefinition.GetPathType(path); if (pathType == RemoteDefinition.PathType.GrasshopperDefinition) { - if (!File.Exists(path)) + if (!File.Exists(path) && !path.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { - if(path.StartsWith("http", StringComparison.OrdinalIgnoreCase)) - { - RemoteDefinitionLocation = path; - } - else - { - // See if the file is in the same directory as this definition. If it - // is then use that file. NOTE: This will change the saved path for - // for this component when we save the GH definition again. That may or - // may not be a problem; I'm not sure yet. - string parentDirectory = Path.GetDirectoryName(reader.ArchiveLocation); - string remoteFileName = Path.GetFileName(path); - string filePath = Path.Combine(parentDirectory, remoteFileName); - if (File.Exists(filePath)) - path = filePath; - } + // See if the file is in the same directory as this definition. If it + // is then use that file. NOTE: This will change the saved path for + // for this component when we save the GH definition again. That may or + // may not be a problem; I'm not sure yet. + string parentDirectory = Path.GetDirectoryName(reader.ArchiveLocation); + string remoteFileName = Path.GetFileName(path); + string filePath = Path.Combine(parentDirectory, remoteFileName); + if (File.Exists(filePath)) + path = filePath; + } } RemoteDefinitionLocation = path;