Closed OptoCloud closed 1 year ago
This is a known issue. Unfortunately, there is little I can do about it.
FlatSharp uses the paths generated by flatc internally. These paths are all relative, and on Windows they do not include the drive letter. An example of a real path that flatc produces is this:
//../../../:/git/FlatSharp/test.fbs
Unfortunately, the drive letter is not present, so FlatSharp can only make guesses about the location of the file. It looks like you've contributed to google/flatbuffers before. One thing that would allow me to effectively mitigate this would be an option to add absolute paths to bfbs output instead of relative.
Ah I see... But that would probably break backwards compatibility, so I'm guessing they won't implement that. I can see if I find some way to have the nuget packages cached on the same drive as the source code. Thanks for the quick answer! 😄
Would be nice to have some kind of detection for seperate drives and give a better exception message tho 🤔
Agree completely. You've actually inspired me to see if I can get flatc to add a drive letter to the relative path.
Fixed in 7.2.1, which uses a custom build of flatc :)
@OptoCloud -- is this working for you now?
Yeah, looks to be working fine 😄 Thanks! 😁
When trying to compile a schema, flatsharp attempts to get a relative path to that schema from the flatsharp compiler. If the flatsharp compiler exists in the nuget cache and the repository exists on a drive used for development, flatsharp will crash with cryptic error-messages.
This is an error message where these are the conditions:
Flatsharp compiler path:
C:\Users\optocloud\.nuget\packages\flatsharp.compiler\7.2.0\tools\net6.0\FlatSharp.Compiler.exe
Schema path:
H:\source\c#\asp.net\backend\schemas\Hello.fbs
Exception message:
Flatsharp needs to detect that the schema files are on a different drive and use alternative methods to get a path to those files.