From 6668b0464f88b6cc6bda9d1541b00937c37441b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Czeka=C5=84ski?= Date: Wed, 7 Feb 2024 01:02:11 +0100 Subject: [PATCH] extractodx: Create outdir if not present Allows binaries to be extracted to `--outdir` without having to manually create it. --- extractodx.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extractodx.py b/extractodx.py index f53f2ce..3f35a44 100644 --- a/extractodx.py +++ b/extractodx.py @@ -220,6 +220,8 @@ def extract_odx(odx_string, flash_info: constants.FlashInfo, is_dsg=False): file_data = Path(args.file).read_text() (data_blocks, allowed_boxcodes) = extract_odx(file_data, flash_info, args.dsg) + os.makedirs(args.outdir, exist_ok=True) + for data_block in data_blocks: print(data_block) with open(os.path.join(args.outdir, data_block), "wb") as dataFile: