From 2bbdec394f2885afe1122789f035ccd11eb8d484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Sat, 14 Sep 2019 11:21:40 +0200 Subject: [PATCH] roar.py: fix argument handling. --- roar.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/roar.py b/roar.py index f66cb1d..8daedea 100755 --- a/roar.py +++ b/roar.py @@ -15,14 +15,15 @@ import wx # Entry point def main(*argv): wxApp, roarClient = wx.App(False), RoarClient(None) + argv0, argv = argv[0], argv[1:] if len(argv) >= 1: - if argv[2].endswith(".lst"): - roarClient.assetsWindow._load_list(argv[2]) - roarClient.canvasPanel.commands.canvasPathName = argv[1] - rc, error = roarClient.canvasPanel.canvas.importStore.importTextFile(argv[1]) + if (len(argv) >= 2) and (argv[1].endswith(".lst")): + roarClient.assetsWindow._load_list(argv[1]) + roarClient.canvasPanel.commands.canvasPathName = argv[0] + rc, error = roarClient.canvasPanel.canvas.importStore.importTextFile(argv[0]) if rc: roarClient.canvasPanel.update(roarClient.canvasPanel.canvas.importStore.inSize, False, roarClient.canvasPanel.canvas.importStore.outMap) - roarClient.canvasPanel.commands.update(pathName=argv[1], undoLevel=-1) + roarClient.canvasPanel.commands.update(pathName=argv[0], undoLevel=-1) else: print("error: {}".format(error), file=sys.stderr) wxApp.MainLoop()