From b3a6650a6f6c3be03dd99bfe15ad00be74d02f08 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Fri, 27 Jan 2017 14:31:44 -0500 Subject: [PATCH] Updated error msg when database cannot be written on disk (write permission issue) --- app/src/main.cpp | 1 + corelib/src/DBDriverSqlite3.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main.cpp b/app/src/main.cpp index eb91c326..4f49c754 100644 --- a/app/src/main.cpp +++ b/app/src/main.cpp @@ -47,6 +47,7 @@ int main(int argc, char* argv[]) /* Create tasks */ QApplication * app = new QApplication(argc, argv); + app->setStyleSheet("QMessageBox { messagebox-text-interaction-flags: 5; }"); // selectable message box ParametersMap parameters = Parameters::parseArguments(argc, argv, true); MainWindow * mainWindow = new MainWindow(); diff --git a/corelib/src/DBDriverSqlite3.cpp b/corelib/src/DBDriverSqlite3.cpp index 714dd6ca..48652305 100644 --- a/corelib/src/DBDriverSqlite3.cpp +++ b/corelib/src/DBDriverSqlite3.cpp @@ -345,7 +345,8 @@ bool DBDriverSqlite3::connectDatabaseQuery(const std::string & url, bool overwri } if(rc != SQLITE_OK) { - UFATAL("DB error : %s (path=\"%s\")", sqlite3_errmsg(_ppDb), url.c_str()); + UFATAL("DB error : %s (path=\"%s\"). Make sure that your user has write " + "permission on the target directory (you may have to change the working directory). ", sqlite3_errmsg(_ppDb), url.c_str()); _ppDb = 0; return false; } @@ -434,7 +435,8 @@ void DBDriverSqlite3::disconnectDatabaseQuery(bool save, const std::string & out { UINFO("Saving database to %s ...", outputFile.c_str()); rc = loadOrSaveDb(_ppDb, outputFile, 1); // Save memory to file - UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error (%s): %s", _version.c_str(), sqlite3_errmsg(_ppDb)).c_str()); + UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error (%s), could not save \"%s\": %s. Make sure that your user has write " + "permission on the target directory (you may have to change the working directory). ", _version.c_str(), outputFile.c_str(), sqlite3_errmsg(_ppDb)).c_str()); ULOGGER_DEBUG("Saving DB time = %fs", timer.ticks()); } }