Skip to content

Commit

Permalink
__init__.py: Bugfix for tjas with no extension
Browse files Browse the repository at this point in the history
  • Loading branch information
vivaria authored May 6, 2024
1 parent 0dc3452 commit 80d211b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/tja2fumen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def main(argv: Sequence[str] = ()) -> None:


def parse_files(directory: str) -> Tuple[List[str], List[str]]:
"""Find all .tja or .bin files within a directory."""
"""Find all or .bin files within a directory."""
tja_files, bin_files = [], []
for root, _, files in os.walk(directory):
for file in files:
Expand All @@ -93,7 +93,7 @@ def process_file(fname: str) -> None:
if fname.endswith(".bin"):
print(f"Repairing {fname}")
repair_bin(fname)
elif fname.endswith(".tja"):
else:
print(f"Converting {fname}")
# Parse lines in TJA file
parsed_tja = parse_tja(fname)
Expand All @@ -103,9 +103,6 @@ def process_file(fname: str) -> None:
for course_name, course in parsed_tja.courses.items():
convert_and_write(course, course_name, base_name,
single_course=len(parsed_tja.courses) == 1)
else:
raise ValueError(f"Unrecognized file type: {fname} "
f"(expected .tja or .bin)")


def convert_and_write(tja_data: TJACourse,
Expand Down

0 comments on commit 80d211b

Please sign in to comment.