MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setExecutable

Method setExecutable

app/src/API/Handlers/ProcessHandler.cpp:126–145  ·  view source on GitHub ↗

* @brief Set the executable path for Launch mode. */

Source from the content-addressed store, hash-verified

124 * @brief Set the executable path for Launch mode.
125 */
126API::CommandResponse API::Handlers::ProcessHandler::setExecutable(const QString& id,
127 const QJsonObject& params)
128{
129 if (!params.contains(QStringLiteral("executable"))) {
130 return CommandResponse::makeError(
131 id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: executable"));
132 }
133
134 const QString path = params.value(QStringLiteral("executable")).toString();
135
136 if (!API::isPathAllowed(path))
137 return CommandResponse::makeError(
138 id, ErrorCode::InvalidParam, QStringLiteral("Path is not allowed: ") + path);
139
140 IO::ConnectionManager::instance().process()->setExecutable(path);
141
142 QJsonObject result;
143 result[QStringLiteral("executable")] = path;
144 return CommandResponse::makeSuccess(id, result);
145}
146
147/**
148 * @brief Set the command-line arguments for Launch mode.

Callers

nothing calls this directly

Calls 3

containsMethod · 0.45
valueMethod · 0.45
processMethod · 0.45

Tested by

no test coverage detected