From 5de3e946aed84611e02dd7373b3ee9193c06a49e Mon Sep 17 00:00:00 2001 From: Tian jianyong <11429339@qq.com> Date: Thu, 19 Dec 2024 17:25:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A6=BB=E7=BA=BF=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E8=84=9A=E6=9C=AC=E7=9A=84=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/prepare_offline_packages.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/prepare_offline_packages.sh b/scripts/prepare_offline_packages.sh index ac1793d..56bb5d6 100644 --- a/scripts/prepare_offline_packages.sh +++ b/scripts/prepare_offline_packages.sh @@ -25,10 +25,21 @@ if [ ! -f /etc/centos-release ]; then exit 1 fi -# Get the absolute path of the project root directory -PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +# Get script directory and project root +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(dirname "${SCRIPT_DIR}")" PROJECT_NAME="$(basename "${PROJECT_ROOT}")" +# Check if running from the correct directory +if [ ! -f "${PROJECT_ROOT}/CMakeLists.txt" ] || \ + [ ! -d "${PROJECT_ROOT}/src" ] || \ + [ ! -d "${PROJECT_ROOT}/scripts" ]; then + log_error "This script must be run from the project root directory (CollisionAvoidance)" + log_error "Current directory: $(pwd)" + log_error "Please run: cd /path/to/CollisionAvoidance && ./scripts/prepare_offline_packages.sh" + exit 1 +fi + # Create packages directory PACKAGES_DIR="${PROJECT_ROOT}/packages" log_info "Creating packages directory: ${PACKAGES_DIR}"