MCPcopy Create free account
hub / github.com/KDE/ghostwriter / exportToFile

Method exportToFile

src/export/commandlineexporter.cpp:152–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void CommandLineExporter::exportToFile
153(
154 const ExportFormat *format,
155 const QString &inputFilePath,
156 const QString &text,
157 const QString &outputFilePath,
158 QString &err
159)
160{
161 Q_D(CommandLineExporter);
162
163 QString stdoutOutput;
164 QString stderrOutput;
165
166 if (!d->formatToCommandMap.contains(format)) {
167 err = QObject::tr("%1 format is not supported by this processor.")
168 .arg(format->name());
169 return;
170 }
171
172 QString command = d->formatToCommandMap.value(format);
173
174 if
175 (
176 ! d->executeCommand
177 (
178 command,
179 inputFilePath,
180 text,
181 outputFilePath,
182 m_options,
183 this->m_smartTypographyEnabled,
184 stdoutOutput,
185 stderrOutput
186 )
187 ) {
188 if (!stderrOutput.isNull() && !stderrOutput.isEmpty()) {
189 err = stderrOutput;
190 } else {
191 err = QObject::tr("Failed to execute command: ")
192 + QString("%1").arg(command);
193 }
194 } else {
195 err = QString();
196 }
197}
198
199bool CommandLineExporterPrivate::executeCommand
200(

Callers

nothing calls this directly

Calls 5

executeCommandMethod · 0.80
isNullMethod · 0.80
containsMethod · 0.65
valueMethod · 0.65
nameMethod · 0.45

Tested by

no test coverage detected