/* * This project is subject to the original PHREEQC license. `litephreeqc` is a * version of the PHREEQC code that has been modified to be used as a library. * * It adds a C++ interface on top of the original PHREEQC code, with small * changes to the original code base. * * Authors of Modifications: * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences * */ #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(); }