Skip to content

Commit

Permalink
Add PLUGINDIR cmake setting and define #7027
Browse files Browse the repository at this point in the history
By default, plugins are only searched next to the binary or next to the
other Qt plugins. This optional build variable allows another path to be
configured.

The idea is that on linux the oC packaging probably wants the binary in
something like /opt/owncloud/bin and the plugins in
/opt/owncloud/lib/plugins.

Similarly, distribution packagers probably don't want the plugins next
to the binary or next to the other Qt plugins. This flag allows them to
configure another path that the executable will look in.
  • Loading branch information
ckamm committed Mar 11, 2019
1 parent 6b467ac commit f837915
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ if(WIN32)
set(DATADIR "share")
endif(WIN32)
set(SHAREDIR ${DATADIR})
set(PLUGINDIR "" CACHE STRING "Extra path to look for Qt plugins like for VFS. May be relative to binary.")

#####
## handle BUILD_OWNCLOUD_OSX_BUNDLE
Expand Down
1 change: 1 addition & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@

#cmakedefine SYSCONFDIR "@SYSCONFDIR@"
#cmakedefine SHAREDIR "@SHAREDIR@"
#cmakedefine PLUGINDIR "@PLUGINDIR@"

#endif
11 changes: 11 additions & 0 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,17 @@ Application::Application(int &argc, char **argv)
if (!AbstractNetworkJob::httpTimeout)
AbstractNetworkJob::httpTimeout = cfg.timeout();

#ifdef PLUGINDIR
// Setup extra plugin search path
QString extraPluginPath = QStringLiteral(PLUGINDIR);
if (!extraPluginPath.isEmpty()) {
if (QDir::isRelativePath(extraPluginPath))
extraPluginPath = QDir(QApplication::applicationDirPath()).filePath(extraPluginPath);
qCInfo(lcApplication) << "Adding extra plugin search path:" << extraPluginPath;
addLibraryPath(extraPluginPath);
}
#endif

// Check vfs plugins
if (Theme::instance()->showVirtualFilesOption() && bestAvailableVfsMode() == Vfs::Off) {
qCWarning(lcApplication) << "Theme wants to show vfs mode, but no vfs plugins are available";
Expand Down

0 comments on commit f837915

Please sign in to comment.