mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
calibre-server: Auto-create userdb directory if it does not exist
This commit is contained in:
parent
23fe6dc98b
commit
f5962cb392
@ -76,7 +76,14 @@ class UserManager(object):
|
|||||||
def conn(self):
|
def conn(self):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
if self._conn is None:
|
if self._conn is None:
|
||||||
self._conn = apsw.Connection(self.path)
|
try:
|
||||||
|
self._conn = apsw.Connection(self.path)
|
||||||
|
except apsw.CantOpenError:
|
||||||
|
pdir = os.path.dirname(self.path)
|
||||||
|
if os.path.isdir(pdir):
|
||||||
|
raise
|
||||||
|
os.makedirs(pdir)
|
||||||
|
self._conn = apsw.Connection(self.path)
|
||||||
with self._conn:
|
with self._conn:
|
||||||
c = self._conn.cursor()
|
c = self._conn.cursor()
|
||||||
uv = next(c.execute('PRAGMA user_version'))[0]
|
uv = next(c.execute('PRAGMA user_version'))[0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user