|
4 | 4 | Date : 02-Jan-2006
|
5 | 5 | Copyright : (C) 2006 by Tom Elwertowski
|
6 | 6 | Email : telwertowski at users dot sourceforge dot net
|
7 |
| -/*************************************************************************** |
| 7 | + *************************************************************************** |
8 | 8 | * *
|
9 | 9 | * This program is free software; you can redistribute it and/or modify *
|
10 | 10 | * it under the terms of the GNU General Public License as published by *
|
|
15 | 15 | /* $Id$ */
|
16 | 16 |
|
17 | 17 | #include "qgsapplication.h"
|
18 |
| - |
| 18 | +#include <QFile> |
19 | 19 | #include <QDir>
|
20 | 20 |
|
21 | 21 | QString QgsApplication::mPrefixPath;
|
@@ -44,9 +44,22 @@ QgsApplication::QgsApplication(int & argc, char ** argv, bool GUIenabled)
|
44 | 44 | mPluginPath = mPrefixPath + QString("/lib/qgis");
|
45 | 45 | mPkgDataPath = mPrefixPath + QString("/share/qgis");
|
46 | 46 | #else
|
47 |
| - mPrefixPath = PREFIX; |
48 |
| - mPluginPath = PLUGINPATH; |
49 |
| - mPkgDataPath = PKGDATAPATH; |
| 47 | + // We could just hard code teh path to qgis libs and share but |
| 48 | + // that makes qgis non relocatable which is needed for my |
| 49 | + // generic QGIS linux bundle. So lets start by trying a relative path |
| 50 | + // and then falling back to the paths set in the make process |
| 51 | + if (QFile::exists(applicationDirPath()+"/../share/qgis/images/icons/qgis-icon.png")) |
| 52 | + { |
| 53 | + mPrefixPath = applicationDirPath(); |
| 54 | + mPluginPath = mPrefixPath + QString("/../lib/qgis"); |
| 55 | + mPkgDataPath = mPrefixPath + QString("/../share/qgis"); |
| 56 | + } |
| 57 | + else //fall back to make specified paths |
| 58 | + { |
| 59 | + mPrefixPath = PREFIX; |
| 60 | + mPluginPath = PLUGINPATH; |
| 61 | + mPkgDataPath = PKGDATAPATH; |
| 62 | + } |
50 | 63 | #endif
|
51 | 64 | mThemePath = mPkgDataPath + QString("/themes/default/");
|
52 | 65 | }
|
|
0 commit comments