#include "utils.hpp" #include #include #include #include std::string readFile(const std::string &path) { std::string string_rpath(PATH_MAX, '\0'); if (realpath(path.c_str(), string_rpath.data()) == nullptr) { throw std::runtime_error("Failed to resolve the realpath to file " + path); } std::ifstream file(string_rpath); if (!file.is_open()) { throw std::runtime_error("Failed to open file: " + path); } std::stringstream buffer; buffer << file.rdbuf(); return buffer.str(); }