check if db is writable before using it

clearer error messages
This commit is contained in:
t-h-i-s-u-s-e-r-n-a-m-e-i-s-c-a-n-c-e-r 2021-08-08 07:53:58 +02:00 committed by GitHub
parent a18ecfd633
commit 5bfce45767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,9 @@
DBManager::DBManager() :
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.setDatabaseName("config/akashi.db");
if (!db.open())