Print a nice banner and handle some errors in a more friendly way.

This commit is contained in:
Godzil 2019-10-07 17:58:32 +01:00
parent 3c741cd219
commit 3bcd2b6173

View File

@ -321,6 +321,8 @@ class BootSplash(object):
def main():
print("WonderSwan SplashBuilder v")
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config", required=True, type=str, help="Configuration file")
parser.add_argument("-o", "--output", type=str, help="Output file", default="output.bin")
@ -333,8 +335,14 @@ def main():
print("Error: config file '{f}' not found".format(f=args.config))
return -1
try:
bs = BootSplash(config)
bs.write(args.output)
except FileNotFoundError as e:
print("Error: The file '{f}' cannot be found,"
" please check your config file".format(f=e.filename))
except Exception as e:
print("Error: {e}".format(e=e))
if __name__ == "__main__":