Skip to content

Commit

Permalink
fix QgsApplication::setPrefixPath
Browse files Browse the repository at this point in the history
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 304275a
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions src/core/qgsapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}

Expand Down

0 comments on commit 304275a

Please sign in to comment.