FixUp: save config

This commit is contained in:
Ben Jackson 2020-12-31 20:55:35 +00:00
commit 2fa6142c8f

View file

@ -173,10 +173,13 @@ def SaveConfiguration( configuration ):
if not gen: if not gen:
return return
config_path = utils.AskForInput( if utils.Confirm(
f'Would you like to save the configuration named "{ gen[ "name" ] }"' f'Would you like to save the configuration named "{ gen[ "name" ] }"',
'? Enter the path to save to (ctrl-c to cancel): ', '&Yes\n&No' ) != 1:
gen[ 'path' ] ) return
config_path = utils.AskForInput( 'Enter the path to save to: ',
gen[ 'path' ] )
if not config_path: if not config_path:
return return
@ -185,7 +188,7 @@ def SaveConfiguration( configuration ):
current_contents = {} current_contents = {}
if os.path.exists( config_path ): if os.path.exists( config_path ):
if utils.Confirm( 'File exists, overwrite? (NOTE: comments and ' if utils.Confirm( 'File exists, overwrite?\n(NOTE: comments and '
'formatting in the existing file will be LOST!!)', 'formatting in the existing file will be LOST!!)',
'&Yes\n&No' ) == 1: '&Yes\n&No' ) == 1:
with open( config_path, 'r' ) as f: with open( config_path, 'r' ) as f: