Allow specifying a non-existent folder when creating a new library. The folder is automatically created

This commit is contained in:
Kovid Goyal 2017-11-30 10:10:03 +05:30
parent b41c55e811
commit 581d15d8eb
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -180,8 +180,11 @@ class ChooseLibrary(QDialog, Ui_Dialog):
if e.errno != errno.EEXIST: if e.errno != errno.EEXIST:
raise raise
if not loc or not os.path.exists(loc) or not os.path.isdir(loc): if not loc or not os.path.exists(loc) or not os.path.isdir(loc):
return error_dialog(self, _('Bad location'), if action == 'new' and not os.path.exists(loc):
_('%s is not an existing folder')%loc, show=True) os.makedirs(loc)
else:
return error_dialog(self, _('Bad location'),
_('%s is not an existing folder')%loc, show=True)
if not self.check_action(action, loc): if not self.check_action(action, loc):
return return
self.location.save_history() self.location.save_history()