From 16be20e2fadb78344c718307c953f553e937d5ae Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 15 Apr 2020 21:45:32 +1000 Subject: [PATCH] don't write log files when exporting --- pylib/anki/storage.py | 3 ++- qt/aqt/main.py | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pylib/anki/storage.py b/pylib/anki/storage.py index a076520ad..07b669e4e 100644 --- a/pylib/anki/storage.py +++ b/pylib/anki/storage.py @@ -32,6 +32,7 @@ def Collection( path: str, backend: Optional[RustBackend] = None, server: Optional[ServerData] = None, + log: bool = False, ) -> _Collection: "Open a new or existing collection. Path must be unicode." assert path.endswith(".anki2") @@ -40,7 +41,7 @@ def Collection( (media_dir, media_db) = media_paths_from_col_path(path) log_path = "" - if not server: + if not server and log: log_path = path.replace(".anki2", "2.log") path = os.path.abspath(path) diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 4d5370e9f..5f94561da 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -475,13 +475,12 @@ close the profile or restart Anki.""" return True def _loadCollection(self): - cpath = self.pm.collectionPath() - self.col = Collection(cpath, backend=self.backend) + self.reopen() self.setEnabled(True) def reopen(self): cpath = self.pm.collectionPath() - self.col = Collection(cpath, backend=self.backend) + self.col = Collection(cpath, backend=self.backend, log=True) def unloadCollection(self, onsuccess: Callable) -> None: def callback():