Skip to content

OSX Builds Crash Fix#66

Merged
SoloByte merged 3 commits intomainfrom
osx-build-crash-fix
May 30, 2025
Merged

OSX Builds Crash Fix#66
SoloByte merged 3 commits intomainfrom
osx-build-crash-fix

Conversation

@SoloByte
Copy link
Collaborator

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.

SoloByte added 2 commits May 29, 2025 10:56
This fix should probably be in shape engine instead of examples.
@SoloByte SoloByte self-assigned this May 29, 2025
@SoloByte SoloByte requested a review from Copilot May 29, 2025 14:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in Game.cs to 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...

@SoloByte SoloByte requested a review from Copilot May 29, 2025 14:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SoloByte SoloByte merged commit edf9771 into main May 30, 2025
7 checks passed
@SoloByte SoloByte deleted the osx-build-crash-fix branch May 30, 2025 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants