Skip to content
Permalink
Browse files

fix QgsApplication::setPrefixPath

setPrefixPath was useless outside of the app since mPrefixPath was overwritten by env variables
  • Loading branch information
3nids committed Apr 9, 2018
1 parent 5b7b7be commit 304275ab019225cd33b30c9235c8ec3098956ffb
Showing with 23 additions and 20 deletions.
  1. +23 −20 src/core/qgsapplication.cpp
@@ -208,32 +208,35 @@ void QgsApplication::init( QString profileFolder )
}
else
{
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
if ( !prefixPath )
if ( ABISYM( mPrefixPath ).isNull() )
{
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
if ( !prefixPath )
{
#if defined(Q_OS_MACX) || defined(Q_OS_WIN)
setPrefixPath( applicationDirPath(), true );
setPrefixPath( applicationDirPath(), true );
#elif defined(ANDROID)
// this is "/data/data/org.qgis.qgis" in android
QDir myDir( QDir::homePath() );
myDir.cdUp();
QString myPrefix = myDir.absolutePath();
setPrefixPath( myPrefix, true );
// this is "/data/data/org.qgis.qgis" in android
QDir myDir( QDir::homePath() );
myDir.cdUp();
QString myPrefix = myDir.absolutePath();
setPrefixPath( myPrefix, true );
#else
QDir myDir( applicationDirPath() );
// Fix for server which is one level deeper in /usr/lib/cgi-bin
if ( applicationDirPath().contains( QStringLiteral( "cgi-bin" ) ) )
QDir myDir( applicationDirPath() );
// Fix for server which is one level deeper in /usr/lib/cgi-bin
if ( applicationDirPath().contains( QStringLiteral( "cgi-bin" ) ) )
{
myDir.cdUp();
}
myDir.cdUp(); // Go from /usr/bin or /usr/lib (for server) to /usr
QString myPrefix = myDir.absolutePath();
setPrefixPath( myPrefix, true );
#endif
}
else
{
myDir.cdUp();
setPrefixPath( prefixPath, true );
}
myDir.cdUp(); // Go from /usr/bin or /usr/lib (for server) to /usr
QString myPrefix = myDir.absolutePath();
setPrefixPath( myPrefix, true );
#endif
}
else
{
setPrefixPath( prefixPath, true );
}
}

0 comments on commit 304275a

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