2014-08-13 10:39:27 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# This is a stub script that allows .apps to be relocatable on OSX but still
|
|
|
|
# find the managed assembly.
|
|
|
|
#
|
|
|
|
# You should never have to edit this file directly as its generated by the
|
|
|
|
# bundle maker.
|
|
|
|
#
|
|
|
|
|
|
|
|
X11_MODE=%X11_MODE%
|
|
|
|
MWF_MODE=%MWF_MODE%
|
|
|
|
COCOASHARP_MODE=%COCOASHARP_MODE%
|
2018-01-24 17:04:36 +00:00
|
|
|
MONO_ARGS=%MONO_ARGS%
|
2014-08-13 10:39:27 +01:00
|
|
|
|
|
|
|
PWD=`pwd`
|
|
|
|
# Fetch the path relative to the launch point where this shell script exists.
|
|
|
|
APP_PATH=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+3] != "") { if (patharr[idx] != "/") {printf("%s/", patharr[idx]); idx++ }} }'`
|
|
|
|
|
|
|
|
# Fetch the app name (its our own name)
|
|
|
|
APP_NAME=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+1] != "") {idx++} printf("%s", patharr[idx]); }'`
|
|
|
|
ASSEMBLY=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+1] != "") {idx++} printf("%s.exe", patharr[idx]); }'`
|
|
|
|
|
|
|
|
# Setup the environment for MWF if needed
|
|
|
|
if [ "$MWF_MODE" -eq "1" ]; then
|
|
|
|
export MONO_MWF_USE_CARBON_BACKEND=1
|
|
|
|
export GDIPLUS_NOX=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Setup the environment for Cocoa# if needed
|
|
|
|
if [ "$COCOASHARP_MODE" -eq "1" ]; then
|
|
|
|
export MONO_GDIP_USE_COCOA_BACKEND=1
|
|
|
|
export DYLD_LIBRARY_PATH=$PWD/$APP_PATH/Contents/Resources:$DYLD_LIBRARY_PATH
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$APP_PATH/Contents/Resources"
|
|
|
|
|
2018-01-24 17:04:36 +00:00
|
|
|
mono4_path=/usr/local/bin/mono
|
|
|
|
mono5_path=/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
|
|
|
|
|
2014-08-13 10:39:27 +01:00
|
|
|
if [ "$X11_MODE" -eq "1" ]; then
|
|
|
|
open-x11 "$APP_NAME"
|
2016-02-22 11:00:01 -05:00
|
|
|
|
|
|
|
# rcruzs00
|
|
|
|
# El Capitan FIX: `which` wont work (system-integrity-protection)
|
|
|
|
# elif: Keep compatibility with previous code
|
2018-01-24 17:04:36 +00:00
|
|
|
elif [ -f "$mono4_path" ]; then
|
2016-02-22 11:00:01 -05:00
|
|
|
DIR=$(cd "$(dirname "$0")"; pwd)
|
2018-01-24 17:04:36 +00:00
|
|
|
"$mono4_path" $MONO_ARGS $DIR/../Resources/"$ASSEMBLY"
|
|
|
|
elif [ -f "$mono5_path" ]; then
|
|
|
|
DIR=$(cd "$(dirname "$0")"; pwd)
|
|
|
|
"$mono5_path" $MONO_ARGS $DIR/../Resources/"$ASSEMBLY"
|
2014-08-13 10:39:27 +01:00
|
|
|
else
|
|
|
|
if [ ! -d "./bin" ]; then mkdir bin ; fi
|
|
|
|
if [ -f "./bin/$APP_NAME" ]; then rm -f "./bin/$APP_NAME" ; fi
|
|
|
|
ln -s `which mono` "./bin/$APP_NAME"
|
2018-01-24 17:04:36 +00:00
|
|
|
"./bin/$APP_NAME" $MONO_ARGS "$ASSEMBLY"
|
2014-08-13 10:39:27 +01:00
|
|
|
fi
|