This commit is contained in:
Kovid Goyal 2020-07-14 20:20:55 +05:30
parent 06f69ee170
commit 6fe1a1dd91
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -151,6 +151,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
if path != gprefs['auto_add_path']: if path != gprefs['auto_add_path']:
if path: if path:
path = os.path.abspath(path) path = os.path.abspath(path)
bname = os.path.basename(path)
self.opt_auto_add_path.setText(path) self.opt_auto_add_path.setText(path)
if not os.path.isdir(path): if not os.path.isdir(path):
error_dialog(self, _('Invalid folder'), error_dialog(self, _('Invalid folder'),
@ -163,7 +164,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
_('You do not have read/write permissions for ' _('You do not have read/write permissions for '
'the folder: %s')%path, show=True) 'the folder: %s')%path, show=True)
raise AbortCommit('invalid auto-add folder') raise AbortCommit('invalid auto-add folder')
if os.path.basename(path)[0] in '._': if bname and bname[0] in '._':
error_dialog(self, _('Invalid folder'), error_dialog(self, _('Invalid folder'),
_('Cannot use folders whose names start with a ' _('Cannot use folders whose names start with a '
'period or underscore: %s')%os.path.basename(path), show=True) 'period or underscore: %s')%os.path.basename(path), show=True)