Skip to content

Commit

Permalink
unify usage message
Browse files Browse the repository at this point in the history
  • Loading branch information
makigumo committed Jan 12, 2019
1 parent 433e009 commit e6b80ac
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions unqar.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,25 @@ def __del__(self):
self.file.close()


if len(sys.argv) < 2:
def print_usage():
print("Usage: %s <qar file> [<output path>]" % sys.argv[0])


if len(sys.argv) < 2:
print_usage()
exit(1)

binaryReader = BinaryReader(sys.argv[1])
output_path = pathlib.Path.cwd()

if len(sys.argv) > 2:
output_path = str(sys.argv[2])

try:
magic = binaryReader.unpack('<H') # 71 02
if magic != 0x0271:
print("Not a supported qar file.")
print("Usage: %s <qar file>" % sys.argv[0])
print_usage()
exit(2)
file_count = binaryReader.unpack('<H')
print("Going to extract %d files." % file_count)
Expand Down

0 comments on commit e6b80ac

Please sign in to comment.