diff --git a/src/solver/modeler/loadFiles/readLibraries.cpp b/src/solver/modeler/loadFiles/readLibraries.cpp index f96c333d08..daae948199 100644 --- a/src/solver/modeler/loadFiles/readLibraries.cpp +++ b/src/solver/modeler/loadFiles/readLibraries.cpp @@ -20,6 +20,7 @@ */ #include +#include #include #include #include "antares/solver/loadFiles/loadFiles.h" @@ -38,4 +39,23 @@ static Study::SystemModel::Library loadSingleLibrary(const fs::path& filePath) return ModelConverter::convert(libraryObj); } + +std::vector loadLibraries(const fs::path& studyPath) +{ + std::vector libraries; + + const fs::path directoryPath = studyPath / "input" / "model-libraries"; + for (const auto& entry : fs::directory_iterator(directoryPath)) + { + if (entry.path().extension() != "yml") + { + logs.info() << "File ignored because of wrong extension: " << entry.path(); + continue; + } + + libraries.push_back(loadSingleLibrary(entry.path())); + } + + return libraries; +} } // namespace Antares::Solver::LoadFiles