Skip to content

Commit

Permalink
Added better logic for application path:
Browse files Browse the repository at this point in the history
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
  • Loading branch information
timlinux committed Feb 16, 2007
1 parent b021fdc commit 1872fe0
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/core/qgsapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Date : 02-Jan-2006
Copyright : (C) 2006 by Tom Elwertowski
Email : telwertowski at users dot sourceforge dot net
/***************************************************************************
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand All @@ -15,7 +15,7 @@
/* $Id$ */

#include "qgsapplication.h"

#include <QFile>
#include <QDir>

QString QgsApplication::mPrefixPath;
Expand Down Expand Up @@ -44,9 +44,22 @@ QgsApplication::QgsApplication(int & argc, char ** argv, bool GUIenabled)
mPluginPath = mPrefixPath + QString("/lib/qgis");
mPkgDataPath = mPrefixPath + QString("/share/qgis");
#else
mPrefixPath = PREFIX;
mPluginPath = PLUGINPATH;
mPkgDataPath = PKGDATAPATH;
// We could just hard code teh path to qgis libs and share 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
if (QFile::exists(applicationDirPath()+"/../share/qgis/images/icons/qgis-icon.png"))
{
mPrefixPath = applicationDirPath();
mPluginPath = mPrefixPath + QString("/../lib/qgis");
mPkgDataPath = mPrefixPath + QString("/../share/qgis");
}
else //fall back to make specified paths
{
mPrefixPath = PREFIX;
mPluginPath = PLUGINPATH;
mPkgDataPath = PKGDATAPATH;
}
#endif
mThemePath = mPkgDataPath + QString("/themes/default/");
}
Expand Down

0 comments on commit 1872fe0

Please sign in to comment.