Skip to content

Commit

Permalink
add a loadLibraries func
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 19, 2024
1 parent b4a2a74 commit 478b087
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/solver/modeler/loadFiles/readLibraries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include <antares/io/file.h>
#include <antares/logs/logs.h>
#include <antares/solver/modelConverter/modelConverter.h>
#include <antares/solver/modelParser/parser.h>
#include "antares/solver/loadFiles/loadFiles.h"
Expand All @@ -38,4 +39,23 @@ static Study::SystemModel::Library loadSingleLibrary(const fs::path& filePath)
return ModelConverter::convert(libraryObj);
}


std::vector<Study::SystemModel::Library> loadLibraries(const fs::path& studyPath)
{
std::vector<Study::SystemModel::Library> 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

0 comments on commit 478b087

Please sign in to comment.