mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
GRASS Direct: Mac DYLD_LIBRARY_PATH fix
This commit is contained in:
parent
452f8da1f8
commit
df2c1c5a8d
@ -342,17 +342,8 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions(
|
||||
{
|
||||
// Set path to GRASS gis fake library
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
#ifdef Q_OS_WIN
|
||||
QString lp = environment.value( "PATH" );
|
||||
lp = QgsApplication::pluginPath() + ";" + lp;
|
||||
environment.insert( "PATH", lp );
|
||||
QgsDebugMsg( "PATH=" + lp );
|
||||
#else
|
||||
QString lp = environment.value( "LD_LIBRARY_PATH" );
|
||||
lp = QgsApplication::pluginPath() + ":" + lp;
|
||||
environment.insert( "LD_LIBRARY_PATH", lp );
|
||||
QgsDebugMsg( "LD_LIBRARY_PATH=" + lp );
|
||||
#endif
|
||||
|
||||
QgsGrassModule::setDirectLibraryPath( environment );
|
||||
environment.insert( "QGIS_PREFIX", QgsApplication::prefixPath() );
|
||||
// Window to avoid crash in G__gisinit
|
||||
environment.insert( "GRASS_REGION", "west:0;south:0;east:1;north:1;cols:1;rows:1;proj:0;zone:0" );
|
||||
@ -1644,17 +1635,12 @@ void QgsGrassModule::run()
|
||||
if ( mDirect )
|
||||
{
|
||||
QStringList variables;
|
||||
setDirectLibraryPath( environment );
|
||||
#ifdef Q_OS_WIN
|
||||
QString lp = environment.value( "PATH" );
|
||||
lp = QgsApplication::pluginPath() + ";" + lp;
|
||||
environment.insert( "PATH", lp );
|
||||
QgsDebugMsg( "PATH=" + lp );
|
||||
variables << "PATH";
|
||||
#elif Q_OS_MAC
|
||||
variables << "DYLD_LIBRARY_PATH";
|
||||
#else
|
||||
QString lp = environment.value( "LD_LIBRARY_PATH" );
|
||||
lp = QgsApplication::pluginPath() + ":" + lp;
|
||||
environment.insert( "LD_LIBRARY_PATH", lp );
|
||||
QgsDebugMsg( "LD_LIBRARY_PATH=" + lp );
|
||||
variables << "LD_LIBRARY_PATH";
|
||||
#endif
|
||||
environment.insert( "QGIS_PREFIX_PATH", QgsApplication::prefixPath() );
|
||||
@ -2010,6 +1996,26 @@ QDomNode QgsGrassModule::nodeByKey( QDomElement elem, QString key )
|
||||
return QDomNode();
|
||||
}
|
||||
|
||||
void QgsGrassModule::setDirectLibraryPath( QProcessEnvironment & environment )
|
||||
{
|
||||
QString pathVariable;
|
||||
QString separator;
|
||||
#ifdef Q_OS_WIN
|
||||
pathVariable = "PATH";
|
||||
separator = ";";
|
||||
#elif Q_OS_MAC
|
||||
pathVariable = "DYLD_LIBRARY_PATH";
|
||||
separator = ":";
|
||||
#else
|
||||
pathVariable = "LD_LIBRARY_PATH";
|
||||
separator = ":";
|
||||
#endif
|
||||
QString lp = environment.value( pathVariable );
|
||||
lp = QgsApplication::pluginPath() + separator + lp;
|
||||
environment.insert( pathVariable, lp );
|
||||
QgsDebugMsg( pathVariable + "=" + lp );
|
||||
}
|
||||
|
||||
/******************* QgsGrassModuleOption ****************************/
|
||||
|
||||
QgsGrassModuleOption::QgsGrassModuleOption( QgsGrassModule *module, QString key,
|
||||
|
@ -111,6 +111,9 @@ class QgsGrassModule: public QDialog, private Ui::QgsGrassModuleBase
|
||||
//! Returns true if module is direct
|
||||
bool isDirect() { return mDirect; }
|
||||
|
||||
//! Set LD_LIBRARY_PATH or equivalent to GRASS Direct library
|
||||
static void setDirectLibraryPath( QProcessEnvironment & environment );
|
||||
|
||||
signals:
|
||||
// ! emitted when the module started
|
||||
void moduleStarted();
|
||||
|
@ -17,7 +17,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "qgsgrassgislibfunctions.h"
|
||||
#endif
|
||||
#include "qgsgrassgislib.h"
|
||||
|
||||
#include "qgslogger.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user