Is there a way to reference the database.sqlite file without knowing the absolute path?
_db = QSqlDatabase::addDatabase("QSQLITE");
_db.setDatabaseName("/the/path/i/dont/know/database.sqlite");
I already tried to add the database.sqlite to the Resources folder and call it via
qrc:
, but apparently it is not possible to write to a resource file.I also tried using
QApplication::applicationDirPath();
, but this would result in different paths depending on the user's OS. E.g. it appendsMyApp.app/Contents/MacOS
to the actual directory.