MCPcopy Create free account
hub / github.com/OpenMW/openmw / startProcess

Method startProcess

components/process/processinvoker.cpp:50–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48// }
49
50bool Process::ProcessInvoker::startProcess(const QString& name, const QStringList& arguments, bool detached)
51{
52 // mProcess = new QProcess(this);
53 mName = name;
54 mArguments = arguments;
55 mIgnoreErrors = false;
56
57 QString path(name);
58#ifdef Q_OS_WIN
59 path.append(QLatin1String(".exe"));
60#endif
61 QDir dir(QCoreApplication::applicationDirPath());
62 path = dir.absoluteFilePath(path);
63
64 QFileInfo info(path);
65
66 if (!info.exists())
67 {
68 QMessageBox msgBox;
69 msgBox.setWindowTitle(tr("Error starting executable"));
70 msgBox.setIcon(QMessageBox::Warning);
71 msgBox.setStandardButtons(QMessageBox::Ok);
72 msgBox.setText(
73 tr("<html><head/><body><p><b>Could not find %1</b></p>"
74 "<p>The application is not found.</p>"
75 "<p>Please make sure OpenMW is installed correctly and try again.</p></body></html>")
76 .arg(info.fileName()));
77 msgBox.exec();
78 return false;
79 }
80
81 if (!info.isExecutable())
82 {
83 QMessageBox msgBox;
84 msgBox.setWindowTitle(tr("Error starting executable"));
85 msgBox.setIcon(QMessageBox::Warning);
86 msgBox.setStandardButtons(QMessageBox::Ok);
87 msgBox.setText(
88 tr("<html><head/><body><p><b>Could not start %1</b></p>"
89 "<p>The application is not executable.</p>"
90 "<p>Please make sure you have the right permissions and try again.</p></body></html>")
91 .arg(info.fileName()));
92 msgBox.exec();
93 return false;
94 }
95
96 // Start the executable
97 if (detached)
98 {
99 if (!mProcess->startDetached(path, arguments))
100 {
101 QMessageBox msgBox;
102 msgBox.setWindowTitle(tr("Error starting executable"));
103 msgBox.setIcon(QMessageBox::Critical);
104 msgBox.setStandardButtons(QMessageBox::Ok);
105 msgBox.setText(
106 tr("<html><head/><body><p><b>Could not start %1</b></p>"
107 "<p>An error occurred while starting %1.</p>"

Callers 7

runSettingsImporterMethod · 0.45
showFirstRunDialogMethod · 0.45
setupGameDataMethod · 0.45
playMethod · 0.45
startNavMeshToolMethod · 0.45

Calls 7

fileNameMethod · 0.80
execMethod · 0.80
appendMethod · 0.45
existsMethod · 0.45
setIconMethod · 0.45
setTextMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected