From 2468f3cd8111aa823d6cf4972cabc9924af69205 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Sun, 9 Aug 2020 01:44:26 +0100 Subject: [PATCH] Issue #69 CSL2XSB always asks for confirmation to proceed --- scripts/csl2xsb/CSL2XSB.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/scripts/csl2xsb/CSL2XSB.py b/scripts/csl2xsb/CSL2XSB.py index 1ca45d421..1bfd76a71 100644 --- a/scripts/csl2xsb/CSL2XSB.py +++ b/scripts/csl2xsb/CSL2XSB.py @@ -386,20 +386,18 @@ parser.add_argument('--replaceDR', metavar="TEXT", help="Replace dataRef's root args = parser.parse_args() -# If called with no argument (e.g. by double-clicking the script) ask the user interactively -# if (s)he likes to work on the current directory. -UserWantsIt = None +# ask the user interactively if (s)he likes to work on the current directory. if args.path == 'NULL': args.path = Path.cwd() - print (parser.description) - print ('Do you want to run CSL2XSB on the current directory "'+str(args.path)+'"?') - while True: - UserWantsIt = input ('Answer "y" or "n": ') - if UserWantsIt.upper() == 'N': - print ('You answered "N", so we exit without doing anything. Try "python CSL2XSBpy -h" for help.') - exit() - if UserWantsIt.upper() == 'Y': - break +print (parser.description) +print ('Do you want to run CSL2XSB on the current directory "'+str(args.path)+'"?') +while True: + UserWantsIt = input ('Answer "y" or "n": ') + if UserWantsIt.upper() == 'N': + print ('You answered "N", so we exit without doing anything. Try "python CSL2XSBpy -h" for help.') + exit() + if UserWantsIt.upper() == 'Y': + break # normalize the path, resolves relative paths and makes nice directory delimiters basePath = Path(args.path) @@ -413,9 +411,7 @@ if args.verbose: numConverted = ConvFolder(basePath) print ('Done. Converted ' + str(numConverted) + ' OBJ8 files in total. Produced ' + str(_warnings) + ' warning(s).') -# Running interactively? -if UserWantsIt is not None: - input ("Hit [Enter] to finish.") +input ("Hit [Enter] to finish.") # --- Done --- exit(0)