From 05207037f53035bc8de92c5140be99aa14198c88 Mon Sep 17 00:00:00 2001
From: jon-lee <jon-lee@sjtu.edu.cn>
Date: Thu, 27 Feb 2025 15:45:25 +0800
Subject: [PATCH] fix(diff): get cases path

---
 joj3_config_generator/processers/task.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/joj3_config_generator/processers/task.py b/joj3_config_generator/processers/task.py
index 7248394..b2894b4 100644
--- a/joj3_config_generator/processers/task.py
+++ b/joj3_config_generator/processers/task.py
@@ -276,7 +276,13 @@ def fix_diff(
             stage_cases.append(
                 result.OptionalCmd(
                     stdin=result.CmdFile(
-                        src=f"/home/tt/.config/joj/{task_conf.task.type_}/{stdin}"
+                        src=(
+                            (task_conf.root / task_conf.path)
+                            .parent.joinpath(stdin)
+                            .name
+                            if task_conf.root is not None and task_conf.path is not None
+                            else f"/home/tt/.config/joj/{task_conf.task.type_}/{stdin}"
+                        )
                     ),
                     args=(shlex.split(command) if command is not None else None),
                     cpu_limit=cpu_limit,
@@ -299,7 +305,16 @@ def fix_diff(
                             {
                                 "score": diff_output.score,
                                 "fileName": "stdout",
-                                "answerPath": f"/home/tt/.config/joj/{task_conf.task.type_}/{stdout}",
+                                "answerPath": (
+                                    (task_conf.root / task_conf.path)
+                                    .parent.joinpath(stdout)
+                                    .name
+                                    if (
+                                        task_conf.root is not None
+                                        and task_conf.path is not None
+                                    )
+                                    else f"/home/tt/.config/joj/{task_conf.task.type_}/{stdout}"
+                                ),
                                 "forceQuitOnDiff": diff_output.forcequit,
                                 "alwaysHide": diff_output.hide,
                                 "compareSpace": not diff_output.ignorespaces,