From 7ee0abbde1656b07eb28ddacca3d22bb7aafdbd8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Oct 2018 15:22:54 -0400 Subject: fileapi: Add helper to create and reference a json reply file --- Source/cmFileAPI.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Source/cmFileAPI.cxx') diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx index cf772d99fc..2fa5495a58 100644 --- a/Source/cmFileAPI.cxx +++ b/Source/cmFileAPI.cxx @@ -175,6 +175,18 @@ std::string cmFileAPI::WriteJsonFile( return fileName; } +Json::Value cmFileAPI::MaybeJsonFile(Json::Value in, std::string const& prefix) +{ + Json::Value out; + if (in.isObject() || in.isArray()) { + out = Json::objectValue; + out["jsonFile"] = this->WriteJsonFile(in, prefix); + } else { + out = std::move(in); + } + return out; +} + std::string cmFileAPI::ComputeSuffixHash(std::string const& file) { cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_256); -- cgit v1.2.1