From c396dde854133da5dbcbb891c0a1eee2043f463d Mon Sep 17 00:00:00 2001 From: Hg Date: Wed, 7 Oct 2020 23:57:32 +0200 Subject: [PATCH] don't ouput twice the same name warning: block should be put before --- svg-to-dia.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/svg-to-dia.py b/svg-to-dia.py index 9b3297e..3741706 100755 --- a/svg-to-dia.py +++ b/svg-to-dia.py @@ -89,6 +89,7 @@ def main(): objects={} ) + seen = set() for svg_file in args.svg_file: svg_file = Path(svg_file) @@ -98,6 +99,10 @@ def main(): shape_path = pshapes.joinpath(f"{svg_file.stem}.shape") shape_path.write_text(tshape) print(f"wrote {shape_path}") + if svg_file.stem in seen: + print(f"ignoring duplicate {svg_file.stem}") + continue + seen.add(svg_file.stem) png_file = f'{pshapes}/{svg_file.stem}.png' subprocess.check_call([