From 44a70599c220871ab1028dc59e6d98b38093ee76 Mon Sep 17 00:00:00 2001
From: Chris Holden <ceholden@gmail.com>
Date: Mon, 25 Mar 2019 09:39:02 -0400
Subject: [PATCH] linux-fix-plugins-path

---
 src/app/main.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/app/main.cpp b/src/app/main.cpp
index 4fbbde51bc..c3c96c401e 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -1105,6 +1105,20 @@ int main( int argc, char *argv[] )
   QgsDebugMsgLevel( QStringLiteral( "Rewritten macOS QCoreApplication::libraryPaths: %1" )
                     .arg( QCoreApplication::libraryPaths().join( " " ) ), 4 );
 #endif
+#ifdef Q_OS_LINUX
+  // Same as on Mac OSX -- check for location of "plugins"
+  QString myPath( QCoreApplication::applicationDirPath().append( "/../plugins" ) );
+  if ( !QFile::exists( myPath + "/imageformats" ) )
+  {
+    myPath = QT_PLUGINS_DIR;
+  }
+  QCoreApplication::addLibraryPath( myPath );
+
+  // Debug
+  QgsDebugMsg( QString( "QGIS library paths: " ) );
+  foreach ( const QString &path, QCoreApplication::libraryPaths() )
+    QgsDebugMsg( QString( "    %s" ).arg( path ) );
+#endif
 
 #ifdef Q_OS_MAC
   // Set hidpi icons; use SVG icons, as PNGs will be relatively too small
-- 
2.20.1

