Skip to content

Commit

Permalink
Add QgsApplication::qgisUserDbFilePath() accessor. Use it to resume a…
Browse files Browse the repository at this point in the history
…ccessing the user db and avoid a crash caused by a switch to the srs db.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4699 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Jan 16, 2006
1 parent eaacbbe commit 0cd50ae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -16,6 +16,8 @@

#include "qgsapplication.h"

#include <QDir>

QString QgsApplication::mPrefixPath;
QString QgsApplication::mPluginPath;
QString QgsApplication::mPkgDataPath;
Expand Down Expand Up @@ -105,6 +107,14 @@ const QString QgsApplication::qgisMasterDbFilePath()
return mPkgDataPath + QString("/resources/qgis.db");
}

/*!
Returns the path to the user qgis.db file.
*/
const QString QgsApplication::qgisUserDbFilePath()
{
return QDir::homeDirPath() + QString("/.qgis/qgis.db");
}

/*!
Returns the path to the splash screen image directory.
*/
Expand Down
3 changes: 3 additions & 0 deletions src/core/qgsapplication.h
Expand Up @@ -42,6 +42,9 @@ class QgsApplication: public QApplication
//! Returns the path to the master qgis.db file.
static const QString qgisMasterDbFilePath();

//! Returns the path to the user qgis.db file.
static const QString qgisUserDbFilePath();

//! Returns the path to the splash screen image directory.
static const QString splashPath();

Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsoptions.cpp
Expand Up @@ -264,7 +264,7 @@ void QgsOptions::getEllipsoidList()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open(QString(QgsApplication::srsDbFilePath()+"qgis.db").latin1(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
Expand Down Expand Up @@ -297,7 +297,7 @@ QString QgsOptions::getEllipsoidAcronym(QString theEllipsoidName)
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open(QString(QgsApplication::srsDbFilePath()+"qgis.db").latin1(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
Expand Down Expand Up @@ -329,7 +329,7 @@ QString QgsOptions::getEllipsoidName(QString theEllipsoidAcronym)
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open((QgsApplication::srsDbFilePath()+"qgis.db").latin1(), &myDatabase);
myResult = sqlite3_open(QgsApplication::qgisUserDbFilePath(), &myDatabase);
if(myResult)
{
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
Expand Down

0 comments on commit 0cd50ae

Please sign in to comment.