Use dir for saved selected file if file doesnt exist

This commit is contained in:
Kovid Goyal 2022-07-18 17:34:31 +05:30
parent 1a7a4544f5
commit 98a6234414
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -81,7 +81,10 @@ class FileDialog(QObject):
if os.path.isfile(prev):
prev = os.path.dirname(prev)
else:
prev = os.path.expanduser('~')
if os.path.exists(os.path.dirname(prev)):
prev = os.path.dirname(prev)
else:
prev = os.path.expanduser('~')
initial_dir = os.path.join(prev, bn)
elif no_save_dir:
initial_dir = os.path.expanduser(default_dir)