Show message if failed to import json. Have android builds use different pathing if possible.
This commit is contained in:
12
src/main.cpp
12
src/main.cpp
@@ -56,7 +56,19 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||
app.setWindowIcon(QIcon::fromTheme("org.eyecreate.vehiclevoyage"));
|
||||
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
#ifdef Q_OS_ANDROID
|
||||
if(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).length > 1)
|
||||
{
|
||||
db.setDatabaseName(QDir(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)[1]).filePath("servicerecords.sqlite")); //Use second appdata path on
|
||||
android for shared storage.
|
||||
}
|
||||
else
|
||||
{
|
||||
db.setDatabaseName(QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("servicerecords.sqlite"));
|
||||
}
|
||||
#else
|
||||
db.setDatabaseName(QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("servicerecords.sqlite"));
|
||||
#endif
|
||||
if(!QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).exists())
|
||||
{
|
||||
QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
|
||||
Reference in New Issue
Block a user