@brief Helper function to load a JSON file by name in a search path. @return Json::nullValue if could not load, otherwise parsed contents of file.
| 54 | /// @return Json::nullValue if could not load, otherwise parsed contents of |
| 55 | /// file. |
| 56 | static inline Json::Value |
| 57 | loadFromFile(std::string fn, std::vector<std::string> const &searchPath) { |
| 58 | Json::Value ret{Json::nullValue}; |
| 59 | for (auto const &path : searchPath) { |
| 60 | auto fullFn = boost::filesystem::path(path) / fn; |
| 61 | ret = attemptLoad(fullFn.string()); |
| 62 | if (!ret.isNull()) { |
| 63 | return ret; |
| 64 | } |
| 65 | } |
| 66 | // Last ditch effort, or only attempt if no search path provided |
| 67 | // This effectively uses the current working directory. |
| 68 | ret = attemptLoad(fn); |
| 69 | return ret; |
| 70 | } |
| 71 | |
| 72 | Json::Value resolvePossibleRef(Json::Value const &input, |
| 73 | bool stringAcceptableResult, |
no test coverage detected