check if db is writable before using it
clearer error messages
This commit is contained in:
parent
a18ecfd633
commit
5bfce45767
@ -20,6 +20,9 @@
|
|||||||
DBManager::DBManager() :
|
DBManager::DBManager() :
|
||||||
DRIVER("QSQLITE")
|
DRIVER("QSQLITE")
|
||||||
{
|
{
|
||||||
|
if(!access("config/akashi.db", R_OK | W_OK))
|
||||||
|
qCritical() << "Database Error: Missing permissions. Check if \"" + "config/akashi.db" "\" is writable.\n";
|
||||||
|
|
||||||
db = QSqlDatabase::addDatabase(DRIVER);
|
db = QSqlDatabase::addDatabase(DRIVER);
|
||||||
db.setDatabaseName("config/akashi.db");
|
db.setDatabaseName("config/akashi.db");
|
||||||
if (!db.open())
|
if (!db.open())
|
||||||
|
Loading…
Reference in New Issue
Block a user