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

Method append

app/src/AI/FileSandbox.cpp:626–640  ·  view source on GitHub ↗

* @brief Appends content to an 'AI/' file, creating it if needed. */

Source from the content-addressed store, hash-verified

624 * @brief Appends content to an 'AI/' file, creating it if needed.
625 */
626QJsonObject AI::FileSandbox::append(const QJsonObject& args) const
627{
628 const auto resolved = resolveWrite(args.value(QStringLiteral("path")).toString());
629 if (!resolved.ok)
630 return failure(resolved.error, resolved.hint);
631
632 const auto payload = args.value(QStringLiteral("content")).toString().toUtf8();
633 const QFileInfo info(resolved.path);
634 const qint64 existing = info.isFile() ? info.size() : 0;
635 if (existing + payload.size() > kMaxWriteBytes)
636 return failure(QStringLiteral("too_large"),
637 QStringLiteral("Resulting file would exceed the 4 MB cap."));
638
639 return writeBytes(resolved.path, payload, true, workspaceRoot());
640}
641
642//--------------------------------------------------------------------------------------------------
643// remove

Callers 15

getUpdaterMethod · 0.45
largeFileMethod · 0.45
extractFilesMethod · 0.45
extractDirMethod · 0.45
entryInfoListMethod · 0.45
getFileInfoListMethod · 0.45
SetUpTestSuiteMethod · 0.45
TEST_FFunction · 0.45
MakeFilePathFunction · 0.45
SetUpTestCaseMethod · 0.45
SetUpTestSuiteMethod · 0.45

Calls 4

failureFunction · 0.85
writeBytesFunction · 0.85
valueMethod · 0.45
sizeMethod · 0.45

Tested by 15

largeFileMethod · 0.36
SetUpTestSuiteMethod · 0.36
TEST_FFunction · 0.36
MakeFilePathFunction · 0.36
SetUpTestCaseMethod · 0.36
SetUpTestSuiteMethod · 0.36
TEST_FFunction · 0.36
SetUpTestSuiteMethod · 0.36
TEST_FFunction · 0.36
SetUpTestSuiteMethod · 0.36
TEST_FFunction · 0.36
MakeTestFilePathFunction · 0.36