Mantid
Loading...
Searching...
No Matches
PluginLibraries.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
11
12#include <QtGlobal>
13
17
18namespace MantidQt::API {
19
27std::string qtPluginPathFromCfg(const std::string &key) {
28 static std::string qtMajorVersion;
29 static std::string qtTag("%V");
30 if (qtMajorVersion.empty()) {
31 qtMajorVersion = std::string(QT_VERSION_STR, 0, 1);
32 }
34 return replace(ConfigService::Instance().getString(key), qtTag, qtMajorVersion);
35}
36
43int loadPluginsFromCfgPath(const std::string &key) { return loadPluginsFromPath(qtPluginPathFromCfg(key)); }
44
49int loadPluginsFromPath(const std::string &path) {
50 // We must *NOT* load plugins compiled against a different version of Qt
51 // so we set exclude flags by Qt version.
52 static std::vector<std::string> excludes{"Qt4"};
53 return LibraryManager::Instance().openLibraries(path, LibraryManagerImpl::NonRecursive, excludes);
54}
55} // namespace MantidQt::API
Class for opening shared libraries.
Manage the lifetime of a class intended to be a singleton.
EXPORT_OPT_MANTIDQT_COMMON int loadPluginsFromPath(const std::string &path)
Load plugins from a path.
EXPORT_OPT_MANTIDQT_COMMON int loadPluginsFromCfgPath(const std::string &key)
Load plugins from a path given by the key in the config service.
EXPORT_OPT_MANTIDQT_COMMON std::string qtPluginPathFromCfg(const std::string &key)
Retrieve the path to some qt-related plugins from the mantid configuration If the value contains V th...
MANTID_KERNEL_DLL std::string replace(const std::string &input, const std::string &find_what, const std::string &replace_with)
Return a string with all matching occurence-strings.
Definition: Strings.cpp:74