Skip to content

Commit 8532a24

Browse files
committed
file sys upd.
1 parent 6031e5d commit 8532a24

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

web/api/compile_checker.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ def compile_checker(src_dir: str) -> None:
1515
"""
1616
chk_cpp = os.path.join(src_dir, "chk.cpp")
1717
checker_cpp = os.path.join(src_dir, "checker.cpp")
18+
chk_exec = os.path.join(src_dir, "chk")
19+
checker_exec = os.path.join(src_dir, "checker")
20+
21+
if os.path.isfile(chk_exec) and os.access(chk_exec, os.X_OK):
22+
print(f"✅ 检查器已存在且可执行: {chk_exec}", file=sys.stderr, flush=True)
23+
return
24+
25+
if os.path.isfile(checker_exec) and os.access(checker_exec, os.X_OK):
26+
os.rename(checker_exec, chk_exec)
27+
print("✅ 已将 checker 可执行文件重命名为 chk", file=sys.stderr, flush=True)
28+
return
1829

1930
# 如果 chk.cpp 不存在,则尝试从 checker.cpp 复制
2031
if not os.path.isfile(chk_cpp):

web/app/libs/uoj-rand-lib.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ function uojRandAvaiableTmpFileName() {
2727
function uojRandAvaiableSubmissionFileName() {
2828
$num = uojRand(1, 10000);
2929
if (!file_exists(UOJContext::storagePath()."/submission/$num")) {
30-
system("mkdir ".UOJContext::storagePath()."/submission/$num");
30+
//system("mkdir ".UOJContext::storagePath()."/submission/$num");
31+
system("mkdir -m 777 ".UOJContext::storagePath()."/submission/$num");
3132
}
3233
return uojRandAvaiableFileName("/submission/$num/");
3334
}

0 commit comments

Comments
 (0)