Skip to content

Commit

Permalink
Fix check for Robots plugin when loaded after Extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
visose committed Dec 30, 2021
1 parent 4237273 commit 23dc6ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Product>Extensions</Product>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Description>Assorted components for Grasshopper.</Description>
<Authors>Extensions Authors</Authors>
<Copyright>Copyright (c) 2021 $(Authors)</Copyright>
Expand Down
3 changes: 3 additions & 0 deletions RELEASE
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- version: 1.0.1
changes:
- Fix check for Robots plugin when loaded after Extensions.
- version: 1.0.0
changes:
- Updated to work with the latest Robots plugin.
Expand Down
24 changes: 8 additions & 16 deletions src/Extensions.Grasshopper/ExtensionsInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,16 @@ public class ExtensionsInfo : GH_AssemblyInfo

public ExtensionsInfo()
{
var componentServer = Instances.ComponentServer;

if (componentServer.Libraries.Any(l => l.Name == "Robots"))
foreach (var folder in Folders.AssemblyFolders)
{
IsRobotsInstalled = true;
return;
}

componentServer.GHAFileLoaded += CheckLoadrobots;
}
var files = Directory.EnumerateFiles(folder.Folder, "Robots.gha", SearchOption.TopDirectoryOnly);

void CheckLoadrobots(object sender, GH_GHALoadingEventArgs e)
{
if (e.Name != "Robots")
return;

IsRobotsInstalled = true;
Instances.ComponentServer.GHAFileLoaded -= CheckLoadrobots;
if (files.Any())
{
IsRobotsInstalled = true;
break;
}
}
}

public override string Name => GetInfo<AssemblyProductAttribute>().Product;
Expand Down

0 comments on commit 23dc6ff

Please sign in to comment.