Skip to content

Commit 796e745

Browse files
author
William Yang
committed
fix: 支持从 slug 中提取 stage 名查找检查脚本
cs50/credit -> 先找 /checks/cs50/credit,再找 /checks/credit
1 parent be8d843 commit 796e745

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

bootcs/__main__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,23 @@ def output_json(results, show_log=False):
222222

223223
def find_check_dir(slug):
224224
"""Find the check directory for a given slug."""
225+
# Extract stage name from slug (e.g., "cs50/credit" -> "credit")
226+
stage_name = slug.split("/")[-1] if "/" in slug else slug
227+
225228
# Common locations to search
226229
search_paths = [
227230
Path.cwd() / "checks" / slug,
231+
Path.cwd() / "checks" / stage_name,
228232
Path.cwd().parent / "checks" / slug,
233+
Path.cwd().parent / "checks" / stage_name,
229234
Path.home() / ".local" / "share" / "bootcs" / slug,
230235
]
231236

232-
# Also check environment variable
237+
# Also check environment variable (try both full slug and stage name)
233238
if "BOOTCS_CHECKS_PATH" in os.environ:
234-
search_paths.insert(0, Path(os.environ["BOOTCS_CHECKS_PATH"]) / slug)
239+
checks_path = Path(os.environ["BOOTCS_CHECKS_PATH"])
240+
search_paths.insert(0, checks_path / stage_name)
241+
search_paths.insert(0, checks_path / slug)
235242

236243
for path in search_paths:
237244
if path.exists():

0 commit comments

Comments
 (0)