do it with qt
This commit is contained in:
parent
23b5962e2a
commit
a624fd502a
@ -29,18 +29,8 @@
|
||||
#include <QSqlDriver>
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
#include <QFileInfo>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <io.h>
|
||||
#define access(pathname, mode) _access(pathname, mode)
|
||||
|
||||
#elif defined(__unix__)
|
||||
#include <unistd.h>
|
||||
|
||||
#else
|
||||
#define access(pathname, mode) 1
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @brief A class used to handle database interaction.
|
||||
*
|
||||
|
@ -20,8 +20,12 @@
|
||||
DBManager::DBManager() :
|
||||
DRIVER("QSQLITE")
|
||||
{
|
||||
if(!access("config/akashi.db", R_OK | W_OK))
|
||||
QFileInfo *db_info = new QFileInfo;
|
||||
*db_info = QFileInfo("config/akashi.db");
|
||||
if(!(db_info->isReadable()) || !(db_info->isWritable()))
|
||||
qCritical() << "Database Error: Missing permissions. Check if \"config/akashi.db\" is writable.\n";
|
||||
delete db_info;
|
||||
|
||||
|
||||
db = QSqlDatabase::addDatabase(DRIVER);
|
||||
db.setDatabaseName("config/akashi.db");
|
||||
|
Loading…
Reference in New Issue
Block a user