Print a nice banner and handle some errors in a more friendly way.
This commit is contained in:
parent
3c741cd219
commit
3bcd2b6173
@ -321,6 +321,8 @@ class BootSplash(object):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
print("WonderSwan SplashBuilder v")
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-c", "--config", required=True, type=str, help="Configuration file")
|
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")
|
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))
|
print("Error: config file '{f}' not found".format(f=args.config))
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
try:
|
||||||
bs = BootSplash(config)
|
bs = BootSplash(config)
|
||||||
bs.write(args.output)
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user