fix: 修复 TenantApi watch 脚本仓库根目录识别逻辑

将条件从 || 改为 &&,确保必须同时找到项目文件和 sln 文件才认定为正确的仓库根目录,防止在错误的仓库中运行脚本。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
MSuMshk
2026-01-31 11:38:39 +08:00
parent 61ecc5dc98
commit 220b98da8f

View File

@@ -18,7 +18,8 @@ environment="${ASPNETCORE_ENVIRONMENT:-Development}"
repo_root=""
candidate_dir="${script_dir}"
for _ in 0 1 2 3 4 5; do
if [ -f "${candidate_dir}/${project_path}" ] || [ -f "${candidate_dir}/TakeoutSaaS.sln" ]; then
# 必须同时满足:项目文件存在 且 sln 文件存在
if [ -f "${candidate_dir}/${project_path}" ] && [ -f "${candidate_dir}/TakeoutSaaS.sln" ]; then
repo_root="${candidate_dir}"
break
fi
@@ -27,7 +28,7 @@ for _ in 0 1 2 3 4 5; do
done
if [ -z "${repo_root}" ]; then
echo "未找到仓库根目录(缺少 ${project_path} TakeoutSaaS.sln请在 TenantApi 仓库中运行该脚本。" >&2
echo "未找到仓库根目录(需要同时存在 ${project_path} TakeoutSaaS.sln请在 TenantApi 仓库中运行该脚本。" >&2
exit 1
fi