From df1d5e02891139f323704e90759d457413c7d767 Mon Sep 17 00:00:00 2001 From: Taka Date: Wed, 3 May 2017 11:23:36 +0000 Subject: [PATCH] Delete the database file if extraction failed to find anything at all. --- startup_widget.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/startup_widget.py b/startup_widget.py index 0b584e5..922095d 100644 --- a/startup_widget.py +++ b/startup_widget.py @@ -65,6 +65,10 @@ class AnalyzeThread( QThread ) : self.completed_signal.emit( "" ) finally : db.close_database() + if total_cards <= 0 : + # NOTE: If we extracted nothing (e.g. because Ghostscript isn't installed), we delete the database + # so that we don't start up next time with an empty database. + os.unlink( self.db_fname ) def on_error( self , msg ) : """Show the user an error message."""