按提示词结论补源路径依据锁

This commit is contained in:
cnc
2026-06-02 14:06:59 +08:00
parent dda5b4973e
commit 854cc682b3
4 changed files with 22 additions and 0 deletions

View File

@@ -3,6 +3,9 @@ set -euo pipefail
cd "$(dirname "$0")"
# LinuxCNC source basis: fixed-source probes resolve explicit LinuxCNC-root
# relative paths from src/emc/rs274ngc, src/emc/tooldata, and related source
# directories before compiling or linking source-backed bridge checks.
linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc}
missing_source_message="missing LinuxCNC source"
preflight_cache_dir=${CNC_SIM_PREFLIGHT_CACHE_DIR:-build/linuxcnc-helper-preflight-cache}
@@ -39,6 +42,10 @@ if [[ "$#" -eq 0 ]]; then
fi
for source in "$@"; do
if [[ "$source" = /* || "$source" == .. || "$source" == ../* || "$source" == */.. || "$source" == */../* ]]; then
echo "LinuxCNC source path must be root-relative: $source" >&2
exit 1
fi
full_source="$linuxcnc_root/$source"
if [[ ! -f "$full_source" ]]; then
echo "$missing_source_message: $source" >&2