1 /** 2 * UGENE - Integrated Bioinformatics Tools. 3 * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru> 4 * http://ugene.net 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 * MA 02110-1301, USA. 20 */ 21 22 #ifndef _U2_EXTERNAL_TOOL_SEARCH_TASK_H_ 23 #define _U2_EXTERNAL_TOOL_SEARCH_TASK_H_ 24 25 #include <U2Core/MultiTask.h> 26 #include <U2Core/Task.h> 27 28 namespace U2 { 29 30 class ExternalTool; 31 32 /** 33 * Search the possible paths to the external tool. 34 * Search order: 35 * 1. Tools folder (%UGENE_DIR%/tools) 36 * 2. PATH variable 37 * 3. Current tool's path (if it isn't empty) 38 **/ 39 class ExternalToolSearchTask : public Task { 40 Q_OBJECT 41 public: 42 ExternalToolSearchTask(const QString &toolId); 43 44 void run() override; 45 getToolId()46 const QString &getToolId() const { 47 return toolId; 48 } 49 getPaths()50 const QStringList &getPaths() const { 51 return toolPaths; 52 } 53 54 private: 55 QString getExecutableFileName(ExternalTool *tool); 56 57 QString toolId; 58 QStringList toolPaths; 59 }; 60 61 class ExternalToolsSearchTask : public SequentialMultiTask { 62 Q_OBJECT 63 public: 64 ExternalToolsSearchTask(const QList<Task *> &_tasks); 65 66 virtual QList<Task *> onSubTaskFinished(Task *subTask); 67 }; 68 69 } // namespace U2 70 71 #endif // _U2_EXTERNAL_TOOL_SEARCH_TASK_H_ 72