From 2a6dacc603238fc509df577511511f735601c539 Mon Sep 17 00:00:00 2001 From: AhmedFatthy1040 Date: Thu, 28 Nov 2024 18:30:59 +0200 Subject: [PATCH] Enhance init_includes to handle dynamic include paths --- src/xinterpreter.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/xinterpreter.cpp b/src/xinterpreter.cpp index f099b688..abcec349 100644 --- a/src/xinterpreter.cpp +++ b/src/xinterpreter.cpp @@ -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()