MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / getFileExecutionContext

Function getFileExecutionContext

src/spawn.cpp:875–906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

873}
874
875FileExecutionContext 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

Callers 2

processrunner.cppFile · 0.85
addAsExecutableMethod · 0.85

Calls 7

isExeFileFunction · 0.85
isBatchFileFunction · 0.85
getCmdPathFunction · 0.85
QStringClass · 0.85
isJavaFileFunction · 0.85
findJavaInstallationFunction · 0.85
isEmptyMethod · 0.45

Tested by

no test coverage detected