| Chris@1243 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */ | 
| Chris@1243 | 2 | 
| Chris@1243 | 3 /* | 
| Chris@1243 | 4     Sonic Visualiser | 
| Chris@1243 | 5     An audio file viewer and annotation editor. | 
| Chris@1243 | 6     Centre for Digital Music, Queen Mary, University of London. | 
| Chris@1243 | 7     This file copyright 2006-2016 Chris Cannam and QMUL. | 
| Chris@1243 | 8 | 
| Chris@1243 | 9     This program is free software; you can redistribute it and/or | 
| Chris@1243 | 10     modify it under the terms of the GNU General Public License as | 
| Chris@1243 | 11     published by the Free Software Foundation; either version 2 of the | 
| Chris@1243 | 12     License, or (at your option) any later version.  See the file | 
| Chris@1243 | 13     COPYING included with this distribution for more information. | 
| Chris@1243 | 14 */ | 
| Chris@1243 | 15 | 
| Chris@1243 | 16 #ifndef SV_HELPER_EXEC_PATH_H | 
| Chris@1243 | 17 #define SV_HELPER_EXEC_PATH_H | 
| Chris@1243 | 18 | 
| Chris@1243 | 19 #include <QStringList> | 
| Chris@1243 | 20 | 
| Chris@1243 | 21 /** | 
| Chris@1243 | 22  * Class to find helper executables that have been installed alongside | 
| Chris@1243 | 23  * the application. There may be more than one executable available | 
| Chris@1243 | 24  * with a given base name, because it's possible to have more than one | 
| Chris@1243 | 25  * implementation of a given service. For example, a plugin helper or | 
| Chris@1243 | 26  * scanner may exist in both 32-bit and 64-bit variants. | 
| Chris@1243 | 27  * | 
| Chris@1243 | 28  * This class encodes both the expected locations of helper | 
| Chris@1243 | 29  * executables, and the expected priority between different | 
| Chris@1243 | 30  * implementations (e.g. preferring the architecture that matches that | 
| Chris@1243 | 31  * of the host). | 
| Chris@1243 | 32  */ | 
| Chris@1243 | 33 class HelperExecPath | 
| Chris@1243 | 34 { | 
| Chris@1243 | 35 public: | 
| Chris@1243 | 36     /** | 
| Chris@1243 | 37      * Find a helper executable with the given base name in the bundle | 
| Chris@1243 | 38      * directory or installation location, if one exists, and return | 
| Chris@1243 | 39      * its full path. Equivalent to calling getHelperExecutables() and | 
| Chris@1243 | 40      * taking the first result from the returned list (or "" if empty). | 
| Chris@1243 | 41      */ | 
| Chris@1243 | 42     static QString getHelperExecutable(QString basename); | 
| Chris@1243 | 43 | 
| Chris@1243 | 44     /** | 
| Chris@1243 | 45      * Find all helper executables with the given base name in the | 
| Chris@1243 | 46      * bundle directory or installation location, and return their | 
| Chris@1243 | 47      * full paths in order of priority. | 
| Chris@1243 | 48      */ | 
| Chris@1243 | 49     static QStringList getHelperExecutables(QString basename); | 
| Chris@1243 | 50 | 
| Chris@1243 | 51     /** | 
| Chris@1243 | 52      * Return the list of directories searched for helper | 
| Chris@1243 | 53      * executables. | 
| Chris@1243 | 54      */ | 
| Chris@1243 | 55     static QStringList getHelperDirPaths(); | 
| Chris@1243 | 56 | 
| Chris@1243 | 57     /** | 
| Chris@1243 | 58      * Return the list of executable paths examined in the search for | 
| Chris@1243 | 59      * the helper executable with the given basename. | 
| Chris@1243 | 60      */ | 
| Chris@1243 | 61     static QStringList getHelperCandidatePaths(QString basename); | 
| Chris@1243 | 62 | 
| Chris@1243 | 63 private: | 
| Chris@1243 | 64     static QStringList search(QString, QStringList &); | 
| Chris@1243 | 65 }; | 
| Chris@1243 | 66 | 
| Chris@1243 | 67 #endif |