]> xmof Git - DeDRM.git/commitdiff
obok: make sure that file exists before opening the db
authorNorbert Preining <norbert@preining.info>
Thu, 8 Oct 2015 01:59:34 +0000 (10:59 +0900)
committerNorbert Preining <norbert@preining.info>
Thu, 8 Oct 2015 01:59:34 +0000 (10:59 +0900)
Obok_calibre_plugin/obok_plugin/obok/obok.py

index 04b907592298da6a96404d25b0cd250e65b580bb..4e884e7341a33f771a82683971622df72e8181a6 100644 (file)
@@ -260,7 +260,7 @@ class KoboLibrary(object):
             self.kobodir = os.path.join(device_path, u".kobo")
             # devices use KoboReader.sqlite
             kobodb  = os.path.join(self.kobodir, u"KoboReader.sqlite")
-            if (not(os.path.exists(kobodb))):
+            if (not(os.path.isfile(kobodb))):
                 # give up here, we haven't found anything useful
                 self.kobodir = u""
                 kobodb  = u""
@@ -282,6 +282,12 @@ class KoboLibrary(object):
                 self.kobodir = os.path.join(os.environ['HOME'], u"Library", u"Application Support", u"Kobo", u"Kobo Desktop Edition")
             # desktop versions use Kobo.sqlite
             kobodb = os.path.join(self.kobodir, u"Kobo.sqlite")
+            # check for existence of file
+            if (not(os.path.isfile(kobodb))):
+                # give up here, we haven't found anything useful
+                self.kobodir = u""
+                kobodb  = u""
+
         
         if (self.kobodir != u""):
             self.bookdir = os.path.join(self.kobodir, u"kepub")