File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 16
16
17
17
#include " qgsapplication.h"
18
18
19
+ #include < QDir>
20
+
19
21
QString QgsApplication::mPrefixPath ;
20
22
QString QgsApplication::mPluginPath ;
21
23
QString QgsApplication::mPkgDataPath ;
@@ -105,6 +107,14 @@ const QString QgsApplication::qgisMasterDbFilePath()
105
107
return mPkgDataPath + QString (" /resources/qgis.db" );
106
108
}
107
109
110
+ /* !
111
+ Returns the path to the user qgis.db file.
112
+ */
113
+ const QString QgsApplication::qgisUserDbFilePath ()
114
+ {
115
+ return QDir::homeDirPath () + QString (" /.qgis/qgis.db" );
116
+ }
117
+
108
118
/* !
109
119
Returns the path to the splash screen image directory.
110
120
*/
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ class QgsApplication: public QApplication
42
42
// ! Returns the path to the master qgis.db file.
43
43
static const QString qgisMasterDbFilePath ();
44
44
45
+ // ! Returns the path to the user qgis.db file.
46
+ static const QString qgisUserDbFilePath ();
47
+
45
48
// ! Returns the path to the splash screen image directory.
46
49
static const QString splashPath ();
47
50
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ void QgsOptions::getEllipsoidList()
264
264
sqlite3_stmt *myPreparedStatement;
265
265
int myResult;
266
266
// check the db is available
267
- myResult = sqlite3_open (QString ( QgsApplication::srsDbFilePath ()+ " qgis.db " ). latin1 (), &myDatabase);
267
+ myResult = sqlite3_open (QgsApplication::qgisUserDbFilePath (), &myDatabase);
268
268
if (myResult)
269
269
{
270
270
std::cout << " Can't open database: " << sqlite3_errmsg (myDatabase) << std::endl;
@@ -297,7 +297,7 @@ QString QgsOptions::getEllipsoidAcronym(QString theEllipsoidName)
297
297
int myResult;
298
298
QString myName;
299
299
// check the db is available
300
- myResult = sqlite3_open (QString ( QgsApplication::srsDbFilePath ()+ " qgis.db " ). latin1 (), &myDatabase);
300
+ myResult = sqlite3_open (QgsApplication::qgisUserDbFilePath (), &myDatabase);
301
301
if (myResult)
302
302
{
303
303
std::cout << " Can't open database: " << sqlite3_errmsg (myDatabase) << std::endl;
@@ -329,7 +329,7 @@ QString QgsOptions::getEllipsoidName(QString theEllipsoidAcronym)
329
329
int myResult;
330
330
QString myName;
331
331
// check the db is available
332
- myResult = sqlite3_open (( QgsApplication::srsDbFilePath ()+ " qgis.db " ). latin1 (), &myDatabase);
332
+ myResult = sqlite3_open (QgsApplication::qgisUserDbFilePath (), &myDatabase);
333
333
if (myResult)
334
334
{
335
335
std::cout << " Can't open database: " << sqlite3_errmsg (myDatabase) << std::endl;
You can’t perform that action at this time.
0 commit comments