From 62c4b2860dd99ed8ea94ad2c6fd83f8cb9689496 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 5 Aug 2010 13:32:00 -0600 Subject: [PATCH] Implement #6392 (Save to disk to be forbidden into library) --- src/calibre/gui2/actions.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/calibre/gui2/actions.py b/src/calibre/gui2/actions.py index 5a3a5a7059..eae4dc76f8 100644 --- a/src/calibre/gui2/actions.py +++ b/src/calibre/gui2/actions.py @@ -927,6 +927,14 @@ class SaveToDiskAction(object): # {{{ _('Choose destination directory')) if not path: return + dpath = os.path.abspath(path).replace('/', os.sep) + lpath = self.library_view.model().db.library_path.replace('/', os.sep) + if dpath.startswith(lpath): + return error_dialog(self, _('Not allowed'), + _('You are tying to save files into the calibre ' + 'library. This can cause corruption of your ' + 'library. Save to disk is meant to export ' + 'files from your calibre library elsewhere.'), show=True) if self.current_view() is self.library_view: from calibre.gui2.add import Saver