From ab01a147194465c03c3f24ea3d2342d4cd85cc90 Mon Sep 17 00:00:00 2001 From: 132nd-Professor <132nd-Professor> Date: Tue, 8 Jun 2021 21:30:38 +0200 Subject: [PATCH] zip files: use filename as provided by zip archive We assumed that the txt file is always at the top level of the zip file The tacview files from Hoggit have them nested under multiple directories fixes #1 --- tacview-splitter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tacview-splitter.py b/tacview-splitter.py index b35f415..f09d45b 100644 --- a/tacview-splitter.py +++ b/tacview-splitter.py @@ -117,7 +117,7 @@ def read_data(filenames: Filenames) -> list[str]: """ if filenames.input.is_zip: with ZipFile(filenames.input.zip) as fd_zip: - with fd_zip.open(filenames.input.txt) as fd_tacview: + with fd_zip.open(fd_zip.filelist[0].filename) as fd_tacview: tacview_lines_binary = fd_tacview.readlines() tacview_lines_ascii = [] for line in tacview_lines_binary: