picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.62k stars 328 forks source link

Mac: Fix universal binary build #2612

Closed jnkvca closed 8 months ago

jnkvca commented 8 months ago

My MacOS universal binary builds were corrupted when the C# project name contained some combination of letters. I went digging in and found the culprit. The TrimStart() method does not trim the specified parameter from the string start, but actually trims as much chars from the front of the string as possible as long as the given parameter contains all those chars (reference)). This is used to trim the leading relative path of a file, so as a consequence the path gets corrupted.

For example, if my project name was MYPROJECT trimming bin/Debug/net6.0/osx-arm64/MYPROJECT.app/ from bin/Debug/net6.0/osx-arm64/MYPROJECT.app/Contents/MacOS/MYPROJECT would result in a corrupted path of cOS/MYPROJECT instead of the expected Contents/MacOS/MYPROJECT. Then my universal binary MYPROJECT.app would actually contain a subdirectory cOS with MYPROJECT binary.

cwensley commented 8 months ago

Aha! Great find, thanks for digging into that and fixing the issue!