diff --git a/Tools/OffscreenChecks/Src/Main.cpp b/Tools/OffscreenChecks/Src/Main.cpp index 11d92bd..4882aea 100644 --- a/Tools/OffscreenChecks/Src/Main.cpp +++ b/Tools/OffscreenChecks/Src/Main.cpp @@ -160,18 +160,30 @@ int main(int argc, char** argv) EnsureDirectory(options.outDir); + // 报告路径同样要能在两种工作目录下工作(见上面 `-data` 的说明)。 g_report = std::fopen(reportPath.c_str(), "wb"); + if (g_report == nullptr && reportPath.rfind("../Temp/", 0) == 0) + { + reportPath = reportPath.substr(3); // 去掉 "../" + g_report = std::fopen(reportPath.c_str(), "wb"); + } EmitLine("==============================================================\n"); EmitLine(" Just DataInspector - offscreen checks\n"); EmitLine(" mode=%s out=%s report=%s\n", options.mode.c_str(), options.outDir.c_str(), reportPath.c_str()); EmitLine("==============================================================\n"); - // 数据文件:命令行优先,否则在 TestData 里挑一个可用的样本 + // 数据文件:命令行优先,否则在 TestData 里挑一个可用的样本。 + // ⚠️ 默认路径同时支持「在 Tools/ 下运行」与「在仓库根目录运行」两种习惯: + // 前者要 `../TestData/...`,后者要 `TestData/...`。只认一种会让另一种 + // 静默报 "no data file"(本轮就踩过,容易被误认为工具坏了)。 if (options.dataPath.empty()) { - static const char* const candidates[] = {"../TestData/SCATTER_TEST.csv", "../TestData/[1].CSV", - "../TestData/BIG_DATA.csv", "../TestData/Problem_Data.CSV"}; + static const char* const candidates[] = {"../TestData/SCATTER_TEST.csv", "TestData/SCATTER_TEST.csv", + "../TestData/[1].CSV", "TestData/[1].CSV", + "../TestData/BIG_DATA.csv", "TestData/BIG_DATA.csv", + "../TestData/Problem_Data.CSV", + "TestData/Problem_Data.CSV"}; for (const char* const candidate : candidates) { if (FileExists(candidate)) diff --git a/Tools/README.md b/Tools/README.md index ac21064..27ca1ac 100644 --- a/Tools/README.md +++ b/Tools/README.md @@ -157,6 +157,14 @@ Tools\OffscreenChecks\Build\OffscreenChecks.exe -list `SCATTER_TEST.csv` → `[1].CSV` → `BIG_DATA.csv` → `Problem_Data.CSV`; `TestData/` 不入库,缺失时请用 `-data` 指定。 +> 默认路径(数据 / 输出 / 报告)**同时支持在 `Tools/` 下运行和在仓库根目录运行** +> (两种写法会自动回退),因此下面两种调用等价: +> ```powershell +> cd Tools ; .\OffscreenChecks\Build\OffscreenChecks.exe -all +> .\Tools\OffscreenChecks\Build\OffscreenChecks.exe -all +> ``` +> 显式 `-data` / `-out` / `-report` 仍以**当前工作目录**为准。 + ### 4.1 检查项 | 检查 | 做了什么 | 断言 / 判据 |