| 873 | } |
| 874 | |
| 875 | FileExecutionContext getFileExecutionContext(QWidget* parent, const QFileInfo& target) |
| 876 | { |
| 877 | if (isExeFile(target)) { |
| 878 | return {target, "", FileExecutionTypes::Executable}; |
| 879 | } |
| 880 | |
| 881 | if (isBatchFile(target)) { |
| 882 | return { |
| 883 | getCmdPath(), |
| 884 | QString("/C \"%1\"").arg(QDir::toNativeSeparators(target.absoluteFilePath())), |
| 885 | FileExecutionTypes::Executable}; |
| 886 | } |
| 887 | |
| 888 | if (isJavaFile(target)) { |
| 889 | auto java = findJavaInstallation(target.absoluteFilePath()); |
| 890 | |
| 891 | if (java.isEmpty()) { |
| 892 | java = |
| 893 | QFileDialog::getOpenFileName(parent, QObject::tr("Select binary"), QString(), |
| 894 | QObject::tr("Binary") + " (*.exe)"); |
| 895 | } |
| 896 | |
| 897 | if (!java.isEmpty()) { |
| 898 | return {QFileInfo(java), |
| 899 | QString("-jar \"%1\"") |
| 900 | .arg(QDir::toNativeSeparators(target.absoluteFilePath())), |
| 901 | FileExecutionTypes::Executable}; |
| 902 | } |
| 903 | } |
| 904 | |
| 905 | return {{}, {}, FileExecutionTypes::Other}; |
| 906 | } |
| 907 | |
| 908 | } // namespace spawn |
| 909 |
no test coverage detected