@@ -235,7 +235,8 @@ def add_testcase(in_file: Path) -> None:
235
235
if config .args .legacy and languages :
236
236
for type in PdfType :
237
237
file = export_dir / type .path (languages [0 ], ".pdf" ).name
238
- file .rename (remove_language_pdf_suffix (file , languages [0 ]))
238
+ if file .exists ():
239
+ file .rename (remove_language_pdf_suffix (file , languages [0 ]))
239
240
else :
240
241
for language in languages :
241
242
for type in PdfType :
@@ -333,19 +334,20 @@ def add_testcase(in_file: Path) -> None:
333
334
if (export_dir / "statement" ).exists ():
334
335
(export_dir / "statement" ).rename (export_dir / "problem_statement" )
335
336
for d in ["solution" , "problem_slide" ]:
336
- for f in list (util .glob (problem .path , f"{ d } /*" )):
337
- if f .is_file ():
338
- out = Path ("problem_statement" ) / f .relative_to (problem .path / d )
339
- if out .exists ():
340
- message (
341
- f"Can not export { f .relative_to (problem .path )} as { out } " ,
342
- "Zip" ,
343
- output ,
344
- color_type = MessageType .WARN ,
345
- )
346
- else :
347
- add_file (out , f )
348
- shutil .rmtree (export_dir / d )
337
+ if (export_dir / d ).is_dir ():
338
+ for f in list (util .glob (problem .path , f"{ d } /*" )):
339
+ if f .is_file ():
340
+ out = Path ("problem_statement" ) / f .relative_to (problem .path / d )
341
+ if out .exists ():
342
+ message (
343
+ f"Can not export { f .relative_to (problem .path )} as { out } " ,
344
+ "Zip" ,
345
+ output ,
346
+ color_type = MessageType .WARN ,
347
+ )
348
+ else :
349
+ add_file (out , f )
350
+ shutil .rmtree (export_dir / d )
349
351
350
352
# handle yaml updates
351
353
yaml_path .unlink ()
0 commit comments