fix: sync launcher rules for source checkout

This commit is contained in:
zyl
2026-03-30 02:30:34 +08:00
parent d2c9902966
commit 5db25b513e
2 changed files with 60 additions and 0 deletions

View File

@@ -5,6 +5,8 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
CRATE_DIR="$(cd -- "${SCRIPT_DIR}/../.." && pwd)"
BIN_PATH="${CRATE_DIR}/target/debug/sgclaw"
MANIFEST_PATH="${CRATE_DIR}/Cargo.toml"
RULES_SRC_PATH="${CRATE_DIR}/resources/rules.json"
RULES_DEST_PATH="${CRATE_DIR}/target/debug/resources/rules.json"
needs_build=0
if [[ ! -x "${BIN_PATH}" ]]; then
@@ -25,4 +27,9 @@ if [[ "${needs_build}" -eq 1 ]]; then
cargo build --manifest-path "${MANIFEST_PATH}" --bin sgclaw
fi
if [[ ! -f "${RULES_DEST_PATH}" || "${RULES_SRC_PATH}" -nt "${RULES_DEST_PATH}" ]]; then
mkdir -p "$(dirname -- "${RULES_DEST_PATH}")"
cp "${RULES_SRC_PATH}" "${RULES_DEST_PATH}"
fi
exec "${BIN_PATH}" "$@"