mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: only show import message when problem.yaml found
This commit is contained in:
1 file changed
+5
-2
@@ -489,12 +489,15 @@ export class ProblemModel {
|
|||||||
}
|
}
|
||||||
for (const i of problems) {
|
for (const i of problems) {
|
||||||
try {
|
try {
|
||||||
if (process.env.HYDRO_CLI) logger.info(`Importing problem ${i}`);
|
|
||||||
const files = await fs.readdir(path.join(tmpdir, i), { withFileTypes: true });
|
const files = await fs.readdir(path.join(tmpdir, i), { withFileTypes: true });
|
||||||
if (!files.find((f) => f.name === 'problem.yaml')) continue;
|
if (!files.find((f) => f.name === 'problem.yaml')) continue;
|
||||||
|
if (process.env.HYDRO_CLI) logger.info(`Importing problem ${i}`);
|
||||||
const content = fs.readFileSync(path.join(tmpdir, i, 'problem.yaml'), 'utf-8');
|
const content = fs.readFileSync(path.join(tmpdir, i, 'problem.yaml'), 'utf-8');
|
||||||
const pdoc: ProblemDoc = yaml.load(content) as any;
|
const pdoc: ProblemDoc = yaml.load(content) as any;
|
||||||
if (!pdoc) continue;
|
if (!pdoc) {
|
||||||
|
if (process.env.HYDRO_CLI) logger.error(`Invalid problem.yaml ${i}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let pid = pdoc.pid;
|
let pid = pdoc.pid;
|
||||||
let overridePid = null;
|
let overridePid = null;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user