Mercurial > hg > vamp-plugin-load-checker
diff checker/knownplugins.h @ 35:4154894d638c plugin-path-config
Trim KnownPlugins class down to static info and environment variable lookup; introduce KnownPluginCandidates to provide its former API
author | Chris Cannam |
---|---|
date | Wed, 06 Jun 2018 15:54:26 +0100 |
parents | 6905d8b146f6 |
children |
line wrap: on
line diff
--- a/checker/knownplugins.h Wed Jun 06 13:49:23 2018 +0100 +++ b/checker/knownplugins.h Wed Jun 06 15:54:26 2018 +0100 @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* - Copyright (c) 2016 Queen Mary, University of London + Copyright (c) 2016-2018 Queen Mary, University of London Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation @@ -30,18 +30,13 @@ #ifndef KNOWN_PLUGINS_H #define KNOWN_PLUGINS_H -#include "plugincandidates.h" - #include <string> #include <map> #include <vector> /** - * Class to identify and list candidate shared-library files possibly - * containing plugins in a hardcoded set of known formats. Uses a - * separate process (the "helper", whose executable name must be - * provided at construction) to test-load each library in order to - * winnow out any that fail to load or crash on load. + * Class to provide information about a hardcoded set of known plugin + * formats. * * Requires C++11 and the Qt5 QtCore library. */ @@ -56,8 +51,12 @@ DSSIPlugin }; - KnownPlugins(std::string helperExecutableName, - PluginCandidates::LogCallback *cb = 0); + enum BinaryFormat { + FormatNative, + FormatNonNative32Bit // i.e. a 32-bit plugin but on a 64-bit host + }; + + KnownPlugins(BinaryFormat format); std::vector<PluginType> getKnownPluginTypes() const; @@ -65,48 +64,40 @@ return m_known.at(type).tag; } - stringlist getCandidateLibrariesFor(PluginType type) const { - return m_candidates.getCandidateLibrariesFor(getTagFor(type)); - } - std::string getPathEnvironmentVariableFor(PluginType type) const { return m_known.at(type).variable; } + stringlist getDefaultPathFor(PluginType type) const { + return m_known.at(type).defaultPath; + } + stringlist getPathFor(PluginType type) const { return m_known.at(type).path; } - std::string getHelperExecutableName() const { - return m_helperExecutableName; + std::string getDescriptorFor(PluginType type) const { + return m_known.at(type).descriptor; } - - std::string getFailureReport() const; private: struct TypeRec { std::string tag; std::string variable; + stringlist defaultPath; stringlist path; std::string descriptor; }; typedef std::map<PluginType, TypeRec> Known; Known m_known; - stringlist expandConventionalPath(PluginType type, std::string var); - std::string getDefaultPath(PluginType type); + std::string getUnexpandedDefaultPathString(PluginType type); + std::string getDefaultPathString(PluginType type); + + stringlist expandPathString(std::string pathString); + stringlist expandConventionalPath(PluginType type, std::string variable); - PluginCandidates m_candidates; - std::string m_helperExecutableName; - - /** This returns true if the helper has a name ending in "-32". By - * our convention, this means that it is a 32-bit helper found on - * a 64-bit system, so (depending on the OS) we may need to look - * in 32-bit-specific paths. Note that is32bit() is *not* usually - * true on 32-bit systems; it's used specifically to indicate a - * "non-native" 32-bit helper. - */ - bool is32bit() const; + BinaryFormat m_format; }; #endif