Skip to content
Permalink
Browse files

Added libraryPath() and libexecPath() to QgsApplication

  • Loading branch information
wonder-sk committed Jul 24, 2011
1 parent c42f1ea commit 257ae38486a722c8ded63339be5bdf024baee8e0
@@ -185,6 +185,14 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
//! Returns the path to default style (works as a starting point). Added in QGIS 1.4
static const QString defaultStyleV2Path();

//! Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries
//! @note Added in 2.0
static const QString libraryPath();

//! Returns the path with utility executables (help viewer, crssync, ...)
//! @note Added in 2.0
static const QString libexecPath();

//! Alters prefix path - used by 3rd party apps
static void setPrefixPath(const QString thePrefixPath, bool useDefaultPaths = FALSE);

@@ -4616,7 +4616,7 @@ void QgisApp::loadPythonSupport()
{
QString pythonlibName( "qgispython" );
#if defined(Q_WS_MAC) || defined(Q_OS_LINUX)
pythonlibName.prepend( QgsApplication::prefixPath() + "/" + QGIS_LIB_SUBDIR + "/" );
pythonlibName.prepend( QgsApplication::libraryPath() );
#endif
#ifdef __MINGW32__
pythonlibName.prepend( "lib" );
@@ -399,6 +399,16 @@ const QString QgsApplication::defaultStyleV2Path()
return mPkgDataPath + QString( "/resources/symbology-ng-style.xml" );
}

const QString QgsApplication::libraryPath()
{
return QgsApplication::prefixPath() + "/" + QGIS_LIB_SUBDIR + "/";
}

const QString QgsApplication::libexecPath()
{
return QgsApplication::prefixPath() + "/" QGIS_LIBEXEC_SUBDIR + "/";
}

QgsApplication::endian_t QgsApplication::endian()
{
return ( htonl( 1 ) == 1 ) ? XDR : NDR ;
@@ -144,6 +144,14 @@ class CORE_EXPORT QgsApplication: public QApplication
//! Returns the path to default style (works as a starting point). Added in QGIS 1.4
static const QString defaultStyleV2Path();

//! Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries
//! @note Added in 2.0
static const QString libraryPath();

//! Returns the path with utility executables (help viewer, crssync, ...)
//! @note Added in 2.0
static const QString libexecPath();

//! Alters prefix path - used by 3rd party apps
static void setPrefixPath( const QString thePrefixPath, bool useDefaultPaths = false );

@@ -1395,7 +1395,7 @@ void QgsGrassModule::run()
mOutputTextBrowser->append( "<B>" + commandHtml + "</B>" );

QStringList environment = QProcess::systemEnvironment();
environment.append( "GRASS_HTML_BROWSER=" + QgsApplication::prefixPath() + "/" QGIS_LIBEXEC_SUBDIR "/grass/bin/qgis.g.browser" );
environment.append( "GRASS_HTML_BROWSER=" + QgsApplication::libexecPath() + "grass/bin/qgis.g.browser" );

// Warning: it is not useful to write requested region to WIND file and
// reset then to original beacuse it is reset before
@@ -96,7 +96,7 @@ void QgsGrassShell::initTerminal( QTermWidget *terminal )
env << "TERM=vt100";
env << "GISRC_MODE_MEMORY";
// TODO: we should check if these environment variable were set by user before QGIS was started
env << "GRASS_HTML_BROWSER=" + QgsApplication::prefixPath() + "/" QGIS_LIBEXEC_SUBDIR "/grass/bin/qgis.g.browser";
env << "GRASS_HTML_BROWSER=" + QgsApplication::libexecPath() + "grass/bin/qgis.g.browser";
env << "GRASS_WISH=wish";
env << "GRASS_TCLSH=tclsh";
env << "GRASS_PYTHON=python";
@@ -144,7 +144,7 @@ void QgsGrassTools::runModule( QString name )
if ( name == "shell" )
{
#ifdef WIN32
QgsGrass::putEnv( "GRASS_HTML_BROWSER", QgsApplication::prefixPath() + "/" QGIS_LIBEXEC_SUBDIR "/grass/bin/qgis.g.browser" );
QgsGrass::putEnv( "GRASS_HTML_BROWSER", QgsApplication::libexecPath() + "grass/bin/qgis.g.browser" );
if ( !QProcess::startDetached( getenv( "COMSPEC" ) ) )
{
QMessageBox::warning( 0, "Warning", tr( "Cannot start command shell (%1)" ).arg( getenv( "COMSPEC" ) ) );
@@ -1213,7 +1213,7 @@ QString GRASS_LIB_EXPORT QgsGrass::getInfo( QString info, QString gisdbase, QStr

QStringList arguments;

QString cmd = QgsApplication::prefixPath() + "/" QGIS_LIBEXEC_SUBDIR "/grass/modules/qgis.g.info";
QString cmd = QgsApplication::libexecPath() + "grass/modules/qgis.g.info";

arguments.append( "info=" + info );
if ( !map.isEmpty() )
@@ -125,7 +125,7 @@ QImage* QgsGrassRasterProvider::draw( QgsRectangle const & viewExtent, int pixe
.arg( viewExtent.xMaximum() ).arg( viewExtent.yMaximum() )
.arg( pixelWidth ).arg( pixelHeight ) ) );
QProcess process( this );
QString cmd = QgsApplication::prefixPath() + "/" QGIS_LIBEXEC_SUBDIR "/grass/modules/qgis.d.rast";
QString cmd = QgsApplication::libexecPath() + "grass/modules/qgis.d.rast";
QByteArray data;
try
{
@@ -177,7 +177,7 @@ void QgsGrassRasterProvider::readBlock( int bandNo, int xBlock, int yBlock, void

arguments.append( "format=value" );
QProcess process( this );
QString cmd = QgsApplication::prefixPath() + "/" QGIS_LIBEXEC_SUBDIR "/grass/modules/qgis.d.rast";
QString cmd = QgsApplication::libexecPath() + "grass/modules/qgis.d.rast";
QByteArray data;
try
{
@@ -223,7 +223,7 @@ void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const & viewEx
.arg( pixelWidth ).arg( pixelHeight ) ) );
arguments.append( "format=value" );
QProcess process( this );
QString cmd = QgsApplication::prefixPath() + "/" QGIS_LIBEXEC_SUBDIR "/grass/modules/qgis.d.rast";
QString cmd = QgsApplication::libexecPath() + "grass/modules/qgis.d.rast";
QByteArray data;
try
{
@@ -558,7 +558,7 @@ void QgsGrassRasterValue::start( QString gisdbase, QString location,
mMapset = mapset;
mMapName = map;
// TODO: catch exceptions
QString module = QgsApplication::prefixPath() + "/" QGIS_LIBEXEC_SUBDIR "/grass/modules/qgis.g.info";
QString module = QgsApplication::libexecPath() + "grass/modules/qgis.g.info";
QStringList arguments;

arguments.append( "info=query" );

0 comments on commit 257ae38

Please sign in to comment.
You can’t perform that action at this time.