feat: 优化脚本路径获取和执行逻辑

main
邱棚 2025-03-17 14:45:05 +08:00
parent 02845303ad
commit 386f05bd76
1 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,8 @@
#!/bin/sh
# 获取当前脚本所在目录的绝对路径
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# 使用 readlink -f 获取脚本的真实路径
SCRIPT=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT")
echo "脚本当前目录:$SCRIPT_DIR"
mono "$SCRIPT_DIR"/Release/BenzObstacleDetect.exe
cd "$SCRIPT_DIR/Release" || { echo "进入 Release 文件夹失败"; exit 1; }
mono BenzObstacleDetect.exe