Skip to content

Commit

Permalink
Use Antares::IO::readFile, remove creeping dependency to yuni
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes committed Dec 19, 2024
1 parent 6b35285 commit 61fadbf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/libs/antares/io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,4 +27,4 @@ target_include_directories(io

install(DIRECTORY include/antares
DESTINATION "include"
)
)
3 changes: 1 addition & 2 deletions src/libs/antares/io/include/antares/io/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#define __LIBS_ANTARES_IO_FILE_H__

#include <filesystem>

#include <yuni/core/string.h>
#include <string>

namespace Antares::IO
{
Expand Down
3 changes: 2 additions & 1 deletion src/solver/modeler/parameters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions src/solver/modeler/parameters/parseModelerParameters.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
#include <filesystem>
#include <fstream>

#include <antares/io/file.h>

#include "encoder.hxx"

namespace Antares::Solver
{
static std::string loadFileToString(const std::filesystem::path& filePath)
{
return std::string(std::istreambuf_iterator<char>(std::ifstream(filePath).rdbuf()),
std::istreambuf_iterator<char>());
}

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<ModelerParameters>();
}
Expand Down

0 comments on commit 61fadbf

Please sign in to comment.