fix crash of CLI when no input file specified

This commit is contained in:
janis
2023-06-07 09:04:04 +02:00
parent ce284540a6
commit 7299250437
3 changed files with 9 additions and 5 deletions

View File

@@ -23,7 +23,7 @@ for engine in engineList:
allowedFiletypes = [ 'png', 'jpg' ];
def performChecks ( args, ap, output ):
def performChecks ( args, ap ):
if ( args.details == None or args.details == '' ):
if ( not args.printengines ):
if ( not args.version ):
@@ -33,6 +33,10 @@ def performChecks ( args, ap, output ):
ap.print_usage();
return False
output = args.outputfile;
if ( args.outputfile == None or args.outputfile == '' ):
output = args.inputfile[ :len( args.inputfile ) - 4 ] + '_upscaled' + args.inputfile[ len( args.inputfile ) - 4: ]
# check if output file exists and if, prompt user if it should be overwritten and remove if, if yes
if ( os.path.exists( output ) ):
doReplace = input( '--> File already exists. Do you want to replace it? (Y/n) ' ).lower()
@@ -127,11 +131,11 @@ if __name__ == '__main__':
multiprocessing.freeze_support();
if ( performChecks( args, ap ) ):
output = args.outputfile;
if ( args.outputfile == None or args.outputfile == '' ):
output = args.inputfile[ :len( args.inputfile ) - 4 ] + '_upscaled' + args.inputfile[ len( args.inputfile ) - 4: ]
if ( performChecks( args, ap, output ) ):
mode = 'fsr'
if ( args.mode != None ):
mode = args.mode