Merge pull request #212 from Salanto/db-shenanigans
Fix database permission error when database is first created
This commit is contained in:
commit
535134db98
@ -22,8 +22,14 @@ DBManager::DBManager() :
|
|||||||
{
|
{
|
||||||
const QString db_filename = "config/akashi.db";
|
const QString db_filename = "config/akashi.db";
|
||||||
QFileInfo db_info(db_filename);
|
QFileInfo db_info(db_filename);
|
||||||
if(!db_info.isReadable() || !db_info.isWritable())
|
if (!db_info.exists()) {
|
||||||
qCritical() << tr("Database Error: Missing permissions. Check if \"%1\" is writable.").arg(db_filename);
|
qWarning().noquote() << tr("Database Info: Database not found. Attempting to create new database.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//We should only check if a file is readable/writeable when it actually exists.
|
||||||
|
if(!db_info.isReadable() || !db_info.isWritable())
|
||||||
|
qCritical() << tr("Database Error: Missing permissions. Check if \"%1\" is writable.").arg(db_filename);
|
||||||
|
}
|
||||||
|
|
||||||
db = QSqlDatabase::addDatabase(DRIVER);
|
db = QSqlDatabase::addDatabase(DRIVER);
|
||||||
db.setDatabaseName("config/akashi.db");
|
db.setDatabaseName("config/akashi.db");
|
||||||
|
Loading…
Reference in New Issue
Block a user