From c568668fd0971202c50d7e4d501100e6b06d2886 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Wed, 1 Aug 2018 23:39:19 -0700 Subject: [PATCH] Re-added 'Create ticket folder?' section * Only asked if imaging and mounting a local device for the destination. --- .bin/Scripts/functions/ddrescue.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.bin/Scripts/functions/ddrescue.py b/.bin/Scripts/functions/ddrescue.py index a9b373d3..14c964c1 100644 --- a/.bin/Scripts/functions/ddrescue.py +++ b/.bin/Scripts/functions/ddrescue.py @@ -1004,6 +1004,7 @@ def select_path(skip_device=None): # Local device local_device = select_device( skip_device=skip_device) + s_path = '' # Mount device volume(s) report = mount_volumes( @@ -1028,10 +1029,23 @@ def select_path(skip_device=None): main_entries=vol_options, action_entries=actions) if selection.isnumeric(): - selected_path = DirObj(vol_options[int(selection)-1]['Path']) + s_path = vol_options[int(selection)-1]['Path'] elif selection == 'Q': raise GenericAbort() + # Create folder + if ask('Create ticket folder?'): + ticket_folder = get_simple_string('Please enter folder name') + s_path = os.path.join(s_path, ticket_folder) + try: + os.makedirs(s_path, exist_ok=True) + except OSError: + raise GenericError( + 'Failed to create folder "{}"'.format(s_path)) + + # Create DirObj + selected_path = DirObj(s_path) + elif path_options[index]['Name'] == 'Enter manually': # Manual entry while not selected_path: