MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / initParam_

Method initParam_

src/openms_gui/source/VISUAL/TOPPASToolVertex.cpp:93–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 }
92
93 bool TOPPASToolVertex::initParam_(const QString& old_ini_file)
94 {
95 // this is the only exception for writing directly to the tmpDir, instead of a subdir of tmpDir, as scene()->getTempDir() might not be available yet
96 QString ini_file = File::getTemporaryFile().toQString();
97 QString program = File::findSiblingTOPPExecutable(name_).toQString();
98 QStringList arguments;
99 arguments << "-write_ini" << ini_file;
100
101 if (!type_.empty())
102 {
103 arguments << "-type";
104 arguments << type_.toQString();
105 }
106 // allow for update using old parameters
107 if (old_ini_file != "")
108 {
109 if (!File::exists(old_ini_file))
110 {
111 String msg = String("Could not open old INI file '") + old_ini_file + "'! File does not exist!";
112 if (getScene_() && getScene_()->isGUIMode())
113 {
114 QMessageBox::critical(nullptr, "Error", msg.c_str());
115 }
116 else
117 {
118 OPENMS_LOG_ERROR << msg << std::endl;
119 }
120 tool_ready_ = false;
121 return false;
122 }
123 arguments << "-ini" << old_ini_file;
124 }
125
126 // actually request the INI
127 QProcess p;
128 p.start(program, arguments);
129 if (!p.waitForFinished(-1) || p.exitStatus() != 0 || p.exitCode() != 0)
130 {
131 String msg = String("Error! Call to '") + program + "' '" + String(arguments.join("' '")) +
132 " returned with exit code (" + String(p.exitCode()) + "), exit status (" + String(p.exitStatus()) + ")." +
133 "\noutput:\n" + String(QString(p.readAll())) +
134 "\n";
135 if (getScene_() && getScene_()->isGUIMode())
136 {
137 QMessageBox::critical(nullptr, "Error", msg.c_str());
138 }
139 else
140 {
141 OPENMS_LOG_ERROR << msg << std::endl;
142 }
143 tool_ready_ = false;
144 return false;
145 }
146 if (!File::exists(ini_file))
147 { // it would be weird to get here, since the TOPP tool ran successfully above, so INI file should exist, but nevertheless:
148 String msg = String("Could not open '") + ini_file + "'! It does not exist!";
149 if (getScene_() && getScene_()->isGUIMode())
150 {

Callers

nothing calls this directly

Calls 11

ParamXMLFileClass · 0.85
isGUIModeMethod · 0.80
StringClass · 0.50
QStringClass · 0.50
toQStringMethod · 0.45
emptyMethod · 0.45
startMethod · 0.45
loadMethod · 0.45
copyMethod · 0.45
setValueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected