Skip to content

Instantly share code, notes, and snippets.

@sabman
Last active March 18, 2022 22:15
Show Gist options
  • Save sabman/92cefa88c362893c67ba31b5bb633c64 to your computer and use it in GitHub Desktop.
Save sabman/92cefa88c362893c67ba31b5bb633c64 to your computer and use it in GitHub Desktop.
#!/bin/sh
# The least terrible way to resolve a symlink to its real path.
function realpath() {
/usr/bin/perl -e "use Cwd;print Cwd::abs_path(@ARGV[0])" "$0";
}
CONTENTS="$(dirname "$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")")"
# BINARY_NAME="$(ls "$CONTENTS/MacOS/")"
BINARY_NAME="$(command ls --color=none "$CONTENTS/MacOS/")"
ELECTRON="$CONTENTS/MacOS/$BINARY_NAME"
CLI="$CONTENTS/Resources/app/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment