Skip to content

Commit

Permalink
Enhance init_includes to handle dynamic include paths
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedFatthy1040 committed Nov 28, 2024
1 parent f98cca3 commit 2a6dacc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/xinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,25 @@ __get_cxx_version ()

void interpreter::init_includes()
{
// Add the standard include path
Cpp::AddIncludePath((xeus::prefix_path() + "/include/").c_str());

// Add non-standard include paths from XEUS_SEARCH_PATH
const char* non_standard_paths = XEUS_SEARCH_PATH;

if (non_standard_paths && std::strlen(non_standard_paths) > 0)
{
// Split the paths by colon ':' and add each one
std::istringstream stream(non_standard_paths);
std::string path;
while (std::getline(stream, path, ':'))
{
if (!path.empty())
{
Cpp::AddIncludePath(path.c_str());
}
}
}
}

void interpreter::init_preamble()
Expand Down

0 comments on commit 2a6dacc

Please sign in to comment.