__init__.py
: Bugfix for tjas with no extension
This commit is contained in:
parent
0dc34520cc
commit
80d211b5b1
@ -73,7 +73,7 @@ processed according to the above logic. (Confirmation is required for safety.)
|
|||||||
|
|
||||||
|
|
||||||
def parse_files(directory: str) -> Tuple[List[str], List[str]]:
|
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 = [], []
|
tja_files, bin_files = [], []
|
||||||
for root, _, files in os.walk(directory):
|
for root, _, files in os.walk(directory):
|
||||||
for file in files:
|
for file in files:
|
||||||
@ -93,7 +93,7 @@ def process_file(fname: str) -> None:
|
|||||||
if fname.endswith(".bin"):
|
if fname.endswith(".bin"):
|
||||||
print(f"Repairing {fname}")
|
print(f"Repairing {fname}")
|
||||||
repair_bin(fname)
|
repair_bin(fname)
|
||||||
elif fname.endswith(".tja"):
|
else:
|
||||||
print(f"Converting {fname}")
|
print(f"Converting {fname}")
|
||||||
# Parse lines in TJA file
|
# Parse lines in TJA file
|
||||||
parsed_tja = parse_tja(fname)
|
parsed_tja = parse_tja(fname)
|
||||||
@ -103,9 +103,6 @@ def process_file(fname: str) -> None:
|
|||||||
for course_name, course in parsed_tja.courses.items():
|
for course_name, course in parsed_tja.courses.items():
|
||||||
convert_and_write(course, course_name, base_name,
|
convert_and_write(course, course_name, base_name,
|
||||||
single_course=len(parsed_tja.courses) == 1)
|
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,
|
def convert_and_write(tja_data: TJACourse,
|
||||||
|
Loading…
Reference in New Issue
Block a user