Skip to content

Commit 1872fe0

Browse files
author
timlinux
committed
Added better logic for application path:
We could just hard code the path to qgis libs and share dir (as used to be done) but that makes qgis non relocatable which is needed for my generic QGIS linux bundle. So lets start by trying a relative path and then falling back to the paths set in the make process git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6605 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent b021fdc commit 1872fe0

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/core/qgsapplication.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Date : 02-Jan-2006
55
Copyright : (C) 2006 by Tom Elwertowski
66
Email : telwertowski at users dot sourceforge dot net
7-
/***************************************************************************
7+
***************************************************************************
88
* *
99
* This program is free software; you can redistribute it and/or modify *
1010
* it under the terms of the GNU General Public License as published by *
@@ -15,7 +15,7 @@
1515
/* $Id$ */
1616

1717
#include "qgsapplication.h"
18-
18+
#include <QFile>
1919
#include <QDir>
2020

2121
QString QgsApplication::mPrefixPath;
@@ -44,9 +44,22 @@ QgsApplication::QgsApplication(int & argc, char ** argv, bool GUIenabled)
4444
mPluginPath = mPrefixPath + QString("/lib/qgis");
4545
mPkgDataPath = mPrefixPath + QString("/share/qgis");
4646
#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+
}
5063
#endif
5164
mThemePath = mPkgDataPath + QString("/themes/default/");
5265
}

0 commit comments

Comments
 (0)