Skip to content

Commit 8d46b84

Browse files
authored
run.sh: Resolve target_assembly to an absolute path
1 parent 32ca3c0 commit 8d46b84

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

assets/nix/run.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
# 1. Via CLI: Run ./run.sh <path to game> [doorstop arguments] [game arguments]
99
# 2. Via config: edit the options below and run ./run.sh without any arguments
1010

11-
# Use POSIX-compatible way to get the directory of the executable
12-
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a" || exit; pwd -P)
13-
1411
# LINUX: name of Unity executable
1512
# MACOS: name of the .app directory
1613
executable_name=""
@@ -107,6 +104,9 @@ if [ -x "$1" ] ; then
107104
shift
108105
fi
109106

107+
# Use POSIX-compatible way to get the directory of the executable
108+
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a" || exit; pwd -P)
109+
110110
arch=""
111111
executable_path=""
112112
lib_extension=""
@@ -169,8 +169,7 @@ _readlink() {
169169
echo "$link"
170170
}
171171

172-
173-
resolve_executable_path () {
172+
resolve_abs_path () {
174173
e_path="$(abs_path "$1")"
175174

176175
while [ -L "${e_path}" ]; do
@@ -180,7 +179,7 @@ resolve_executable_path () {
180179
}
181180

182181
# Get absolute path of executable
183-
executable_path=$(resolve_executable_path "${executable_path}")
182+
executable_path=$(resolve_abs_path "${executable_path}")
184183

185184
# Figure out the arch of the executable with file
186185
file_out="$(LD_PRELOAD="" file -b "${executable_path}")"
@@ -284,9 +283,15 @@ while [ $i -lt $max ]; do
284283
i=$((i+1))
285284
done
286285

286+
# Get absolute path of target assembly
287+
if [ "$target_assembly" = "${target_assembly#/}" ]; then
288+
target_assembly_path="${BASEDIR}/${target_assembly}"
289+
fi
290+
target_assembly_path=$(resolve_abs_path "${target_assembly_path}")
291+
287292
# Move variables to environment
288293
export DOORSTOP_ENABLED="$enabled"
289-
export DOORSTOP_TARGET_ASSEMBLY="$target_assembly"
294+
export DOORSTOP_TARGET_ASSEMBLY="$target_assembly_path"
290295
export DOORSTOP_BOOT_CONFIG_OVERRIDE="$boot_config_override"
291296
export DOORSTOP_IGNORE_DISABLED_ENV="$ignore_disable_switch"
292297
export DOORSTOP_MONO_DLL_SEARCH_PATH_OVERRIDE="$dll_search_path_override"

0 commit comments

Comments
 (0)