diff --git a/src/libs/antares/io/CMakeLists.txt b/src/libs/antares/io/CMakeLists.txt index 9e3211e14b..dc62a95aea 100644 --- a/src/libs/antares/io/CMakeLists.txt +++ b/src/libs/antares/io/CMakeLists.txt @@ -12,6 +12,7 @@ source_group("io" FILES ${SRC_IO}) add_library(io ${SRC_IO} ) +add_library(Antares::io ALIAS io) target_link_libraries(io PRIVATE @@ -26,4 +27,4 @@ target_include_directories(io install(DIRECTORY include/antares DESTINATION "include" -) \ No newline at end of file +) diff --git a/src/libs/antares/io/include/antares/io/file.h b/src/libs/antares/io/include/antares/io/file.h index b401b1cece..a9aed8c850 100644 --- a/src/libs/antares/io/include/antares/io/file.h +++ b/src/libs/antares/io/include/antares/io/file.h @@ -22,8 +22,7 @@ #define __LIBS_ANTARES_IO_FILE_H__ #include - -#include +#include namespace Antares::IO { diff --git a/src/solver/modeler/parameters/CMakeLists.txt b/src/solver/modeler/parameters/CMakeLists.txt index 6721526c4c..33cfda091e 100644 --- a/src/solver/modeler/parameters/CMakeLists.txt +++ b/src/solver/modeler/parameters/CMakeLists.txt @@ -6,7 +6,8 @@ add_library(modeler-parameters target_link_libraries(modeler-parameters PRIVATE - yaml-cpp) + yaml-cpp + Antares::io) target_include_directories(modeler-parameters PUBLIC diff --git a/src/solver/modeler/parameters/parseModelerParameters.cpp b/src/solver/modeler/parameters/parseModelerParameters.cpp index a0d1abbc70..39935db38c 100644 --- a/src/solver/modeler/parameters/parseModelerParameters.cpp +++ b/src/solver/modeler/parameters/parseModelerParameters.cpp @@ -1,19 +1,15 @@ #include #include +#include + #include "encoder.hxx" namespace Antares::Solver { -static std::string loadFileToString(const std::filesystem::path& filePath) -{ - return std::string(std::istreambuf_iterator(std::ifstream(filePath).rdbuf()), - std::istreambuf_iterator()); -} - ModelerParameters parseModelerParameters(const std::filesystem::path& path) { - auto contents = loadFileToString(path); + const auto contents = Antares::IO::readFile(path); YAML::Node root = YAML::Load(contents); return root.as(); }