mirror of
https://github.com/NinjaCheetah/WiiPy.git
synced 2026-02-17 02:25:39 -05:00
Cleaned up warnings related to error handling changes
This commit is contained in:
@@ -10,14 +10,12 @@ def handle_u8_pack(args):
|
||||
input_path = pathlib.Path(args.input)
|
||||
output_path = pathlib.Path(args.output)
|
||||
|
||||
u8_data = None
|
||||
try:
|
||||
u8_data = libWiiPy.archive.pack_u8(input_path)
|
||||
except ValueError:
|
||||
fatal_error(f"The specified input file/folder \"{input_path}\" does not exist!")
|
||||
|
||||
out_file = open(output_path, "wb")
|
||||
out_file.write(u8_data)
|
||||
out_file.close()
|
||||
output_path.write_bytes(u8_data)
|
||||
|
||||
print("U8 archive packed!")
|
||||
|
||||
@@ -28,11 +26,8 @@ def handle_u8_unpack(args):
|
||||
|
||||
if not input_path.exists():
|
||||
fatal_error(f"The specified input file \"{input_path}\" does not exist!")
|
||||
|
||||
u8_data = open(input_path, "rb").read()
|
||||
|
||||
# Output path is deliberately not checked in any way because libWiiPy already has those checks, and it's easier
|
||||
# and cleaner to only have one component doing all the checks.
|
||||
libWiiPy.archive.extract_u8(u8_data, str(output_path))
|
||||
libWiiPy.archive.extract_u8(input_path.read_bytes(), str(output_path))
|
||||
|
||||
print("U8 archive unpacked!")
|
||||
|
||||
Reference in New Issue
Block a user