Merged
Conversation
This fix should probably be in shape engine instead of examples.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a crash on macOS by ensuring the working directory is correctly set when launching the game via double-click, and cleans up the now-redundant workaround in the examples project.
- Add an
IsOSX()check inGame.csto set the current directory to the executable’s folder. - Remove the commented-out macOS launch fix from
Examples/Program.cs.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ShapeEngine/Core/Game.cs | Add OS X–specific logic to set the current directory on launch. |
| Examples/Program.cs | Remove obsolete commented workaround; add using ShapeEngine.Core. |
Comments suppressed due to low confidence (2)
ShapeEngine/Core/Game.cs:246
- Add a test (unit or integration) to verify that when
IsOSX()is true, the working directory is correctly set to the executable's folder.
if (IsOSX())
Examples/Program.cs:12
- Remove this commented-out block since the macOS launch fix has been moved into the engine, eliminating dead code and improving readability.
//this is a fix to be able to run the examples executable on macOS with a double click...
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request addresses macOS build crashes by ensuring that the working directory is correctly set to the executable’s location on launch, enabling double-click launches.
- In ShapeEngine/Core/Game.cs, the code now sets the current directory based on AppContext.BaseDirectory when running on macOS.
- In Examples/Program.cs, the previously included code for adjusting the directory has been commented out as it is now redundant.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ShapeEngine/Core/Game.cs | Adds logic to set the working directory using AppContext.BaseDirectory for macOS. |
| Examples/Program.cs | Removes redundant commented-out code related to macOS directory setup. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds would crash on macOS because the directory is not set correctly on game launch. The executable would only work when launched from the command line. This fix should allow to users to launch the exe file with a double click as well.
This is the first step to make build on macOS work better.