hypar-io / Elements

The smallest useful BIM.
https://www.hypar.io
MIT License
347 stars 74 forks source link

ModelText() returns System.IO.DirectoryNotFoundException when run in Notebook #1085

Open daniel-fink opened 3 months ago

daniel-fink commented 3 months ago

In dotnet Interactive/Polyglot Notebooks, constructing a ModelText yields the following error:

Error: System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/daniel/.nuget/packages/hypar.elements/2.2.0-alpha.25/lib/netstandard2.0/Fonts/Roboto-Medium.ttf'.

Looks like this is because (at least on macOS), dotnet/nuget places reference content into two places under the package version (ie in '~/.nuget/packages/..'):

  1. a '../content/..' directory, or
  2. a '../contentFiles/any/framework/..' directory

See https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#including-content-in-a-package where Microsoft states "By default, everything gets added to the root of the content and contentFiles\any\ folder within a package and preserves the relative folder structure, unless you specify a package path"

I think this will directly affect https://github.com/hypar-io/Elements/blob/d246cee1d19c44f4f58392b2fad69f8391a563dc/Elements/src/ModelText.cs#L116 but I'm not sure if/where else..