MCPcopy Create free account
hub / github.com/78/tenbox / CopyIfProvided

Function CopyIfProvided

src/daemon/rpc_server.cpp:38–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38bool CopyIfProvided(const std::string& source, const fs::path& destination_dir, std::string* out, std::string* error) {
39 if (source.empty()) return true;
40 std::error_code ec;
41 fs::path src(source);
42 if (!fs::exists(src, ec)) {
43 if (error) *error = "source file not found: " + source;
44 return false;
45 }
46 fs::path dst = destination_dir / src.filename();
47 fs::copy_file(src, dst, fs::copy_options::overwrite_existing, ec);
48 if (ec) {
49 if (error) *error = "failed to copy " + source + ": " + ec.message();
50 return false;
51 }
52 *out = PathToUtf8(dst);
53 return true;
54}
55
56std::vector<uint8_t> HexDecode(const std::string& value) {
57 auto digit = [](char ch) -> int {

Callers 1

CreateVmMethod · 0.85

Calls 1

PathToUtf8Function · 0.70

Tested by

no test coverage detected