forked from server/soundboard
Ensure relative paths to DB are inside project
This commit is contained in:
parent
eb549417db
commit
ce7f55771c
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import sqlite3
|
||||
|
||||
@ -15,7 +16,12 @@ def getDB():
|
||||
db = getattr(g, "_database", None)
|
||||
|
||||
if db is None:
|
||||
db = g._database = sqlite3.connect(config.db)
|
||||
if os.path.isabs(config.db):
|
||||
dbPath = config.db
|
||||
else:
|
||||
dbPath = os.path.join(sys.path[0], config.db)
|
||||
|
||||
db = g._database = sqlite3.connect(dbPath)
|
||||
db.row_factory = sqlite3.Row
|
||||
|
||||
return db
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user