Chris@1243: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@1243: Chris@1243: /* Chris@1243: Sonic Visualiser Chris@1243: An audio file viewer and annotation editor. Chris@1243: Centre for Digital Music, Queen Mary, University of London. Chris@1243: This file copyright 2006-2016 Chris Cannam and QMUL. Chris@1243: Chris@1243: This program is free software; you can redistribute it and/or Chris@1243: modify it under the terms of the GNU General Public License as Chris@1243: published by the Free Software Foundation; either version 2 of the Chris@1243: License, or (at your option) any later version. See the file Chris@1243: COPYING included with this distribution for more information. Chris@1243: */ Chris@1243: Chris@1243: #ifndef SV_HELPER_EXEC_PATH_H Chris@1243: #define SV_HELPER_EXEC_PATH_H Chris@1243: Chris@1243: #include Chris@1243: Chris@1243: /** Chris@1243: * Class to find helper executables that have been installed alongside Chris@1243: * the application. There may be more than one executable available Chris@1243: * with a given base name, because it's possible to have more than one Chris@1243: * implementation of a given service. For example, a plugin helper or Chris@1243: * scanner may exist in both 32-bit and 64-bit variants. Chris@1243: * Chris@1243: * This class encodes both the expected locations of helper Chris@1243: * executables, and the expected priority between different Chris@1243: * implementations (e.g. preferring the architecture that matches that Chris@1243: * of the host). Chris@1243: */ Chris@1243: class HelperExecPath Chris@1243: { Chris@1243: public: Chris@1246: enum SearchType { Chris@1246: NativeArchitectureOnly, Chris@1246: AllInstalled Chris@1246: }; Chris@1246: Chris@1246: HelperExecPath(SearchType type) : m_type(type) { } Chris@1246: Chris@1243: /** Chris@1243: * Find a helper executable with the given base name in the bundle Chris@1243: * directory or installation location, if one exists, and return Chris@1243: * its full path. Equivalent to calling getHelperExecutables() and Chris@1243: * taking the first result from the returned list (or "" if empty). Chris@1243: */ Chris@1246: QString getHelperExecutable(QString basename); Chris@1246: Chris@1246: struct HelperExec { Chris@1246: QString executable; Chris@1246: QString tag; Chris@1246: }; Chris@1243: Chris@1243: /** Chris@1243: * Find all helper executables with the given base name in the Chris@1243: * bundle directory or installation location, and return their Chris@1246: * full paths in order of priority. The "tag" string contains an Chris@1246: * identifier for the location or architecture of the helper, for Chris@1246: * example "32", "64", "js" etc. An empty tag signifies a default Chris@1246: * helper that matches the application's architecture. Chris@1243: */ Chris@1246: QList getHelperExecutables(QString basename); Chris@1243: Chris@1243: /** Chris@1243: * Return the list of directories searched for helper Chris@1243: * executables. Chris@1243: */ Chris@1246: QStringList getHelperDirPaths(); Chris@1243: Chris@1243: /** Chris@1243: * Return the list of executable paths examined in the search for Chris@1243: * the helper executable with the given basename. Chris@1243: */ Chris@1246: QStringList getHelperCandidatePaths(QString basename); Chris@1243: Chris@1243: private: Chris@1246: SearchType m_type; Chris@1246: QList search(QString, QStringList &); Chris@1246: QStringList getTags(); Chris@1243: }; Chris@1243: Chris@1243: #endif