From 581d15d8eb289ef649019192a07544fbe77af557 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 30 Nov 2017 10:10:03 +0530 Subject: [PATCH] Allow specifying a non-existent folder when creating a new library. The folder is automatically created --- src/calibre/gui2/dialogs/choose_library.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/dialogs/choose_library.py b/src/calibre/gui2/dialogs/choose_library.py index fc08c3ee14..535c729419 100644 --- a/src/calibre/gui2/dialogs/choose_library.py +++ b/src/calibre/gui2/dialogs/choose_library.py @@ -180,8 +180,11 @@ class ChooseLibrary(QDialog, Ui_Dialog): if e.errno != errno.EEXIST: raise if not loc or not os.path.exists(loc) or not os.path.isdir(loc): - return error_dialog(self, _('Bad location'), - _('%s is not an existing folder')%loc, show=True) + if action == 'new' and not os.path.exists(loc): + 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): return self.location.save_history()