| 64 | } |
| 65 | |
| 66 | static ShaderToolOutput RunTool(const ShaderProcessingTool &tool, QWidget *window, |
| 67 | QString input_file, QString output_file, QStringList &argList) |
| 68 | { |
| 69 | bool writesToFile = true; |
| 70 | bool readStdin = false; |
| 71 | |
| 72 | int idx = argList.indexOf(lit("{stdin}")); |
| 73 | if(idx >= 0) |
| 74 | { |
| 75 | argList.removeAt(idx); |
| 76 | readStdin = true; |
| 77 | } |
| 78 | |
| 79 | if(output_file.isEmpty()) |
| 80 | { |
| 81 | output_file = tmpPath(lit("shader_output")); |
| 82 | writesToFile = false; |
| 83 | } |
| 84 | |
| 85 | // ensure we don't have any leftover output files. |
| 86 | QFile::remove(output_file); |
| 87 | |
| 88 | QString stdout_file = QDir(QDir::tempPath()).absoluteFilePath(lit("shader_stdout")); |
| 89 | |
| 90 | ShaderToolOutput ret; |
| 91 | |
| 92 | if(tool.executable.isEmpty()) |
| 93 | { |
| 94 | ret.log = QApplication::translate("ShaderProcessingTool", |
| 95 | "ERROR: No Executable specified in tool '%1'") |
| 96 | .arg(tool.name); |
| 97 | |
| 98 | return ret; |
| 99 | } |
| 100 | |
| 101 | QString path = tool.executable; |
| 102 | |
| 103 | if(!QDir::isAbsolutePath(path)) |
| 104 | { |
| 105 | path = QStandardPaths::findExecutable(path); |
| 106 | |
| 107 | if(path.isEmpty()) |
| 108 | { |
| 109 | ret.log = QApplication::translate("ShaderProcessingTool", |
| 110 | "ERROR: Couldn't find executable '%1' in path") |
| 111 | .arg(tool.executable); |
| 112 | |
| 113 | return ret; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | QByteArray stdout_data; |
| 118 | QProcess process; |
| 119 | |
| 120 | QThread *mainThread = QThread::currentThread(); |
| 121 | |
| 122 | LambdaThread *thread = new LambdaThread([&]() { |
| 123 | if(readStdin) |
no test coverage detected