Skip to content

Conversation

@arrowmaster
Copy link
Contributor

@arrowmaster arrowmaster commented Jan 28, 2026

Multiple updates to the nix run.sh mostly to correct for observed issues from users.

1. Add set -e to halt on any unexpected errors

At least one issue was observed where the file command was not available on a users system. An error was thrown but the script continued and threw more errors. Now it will just stop on any unexpected errors.
#91

2. Add error and exit when Windows executable is detected

This was included in the BepInEx 6 branch some time ago but never made it into upstream and back to BepInEx 5 or other branches. This is an extremely common user error that will now get a correct error message.

3. Allow the rare usage of Steam launching a shell script

There are a few rare games on Steam where the developers call a shell script instead of a binary. They might not work with this change but it at least provide a boilerplate spot for more game specific changes to be placed if needed.

4. Change Steam executable detection to a simpler check for a file located in the working directory

My original solution for a way that did not require executable_name to be set was overly complicated and depended on game executables having the default file extensions from Unity. This solution simply looks for an argument that has a matching prefix with the working directory. Before launching a game, Steam sets the working directory to the game directory then launches the executable in the game directory by absolute path.

Copy link

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 updates the Unix/Linux shell script (run.sh) to address several user-reported issues and improve error handling. The changes focus on making the script more robust and providing better feedback when errors occur.

Changes:

  • Added set -e to halt execution on unexpected errors, preventing cascading failures
  • Simplified Steam executable detection by checking if arguments are prefixed with the working directory path
  • Added explicit detection and error messaging for Windows PE32 executables
  • Added fallback support for games that launch shell scripts instead of binaries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 72 to 73
# Test if argument is prefixed with the value of $PWD
if [ "$1" != "${1#"$PWD"}" ]; then
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

The prefix matching logic could incorrectly match paths with partially matching directory names. For example, if PWD is "/path/to/game" and an argument is "/path/to/gamer/executable", the string prefix "/path/to/game" would be removed, leaving "r/executable", causing the condition to match incorrectly.

While this is unlikely to occur in practice with Steam (which should only pass paths within the game directory), consider making the check more robust by testing if the argument starts with "$PWD/" to ensure it's matching a complete path component.

Suggested change
# Test if argument is prefixed with the value of $PWD
if [ "$1" != "${1#"$PWD"}" ]; then
# Test if argument is prefixed with the value of $PWD followed by a path separator
if [ "$1" != "${1#"$PWD"/}" ]; then

Copilot uses AI. Check for mistakes.
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.

1 participant