File tree Expand file tree Collapse file tree 4 files changed +50
-2
lines changed Expand file tree Collapse file tree 4 files changed +50
-2
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ set(XCPP_TAGCONFS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/etc/xeus-cpp/tags.d)
3333configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /include/xeus-cpp/xeus_cpp_config.hpp.in"
3434 "${CMAKE_CURRENT_SOURCE_DIR} /include/xeus-cpp/xeus_cpp_config.hpp" )
3535
36+ file (COPY "${XCPP_TAGFILES_DIR} " DESTINATION "${CMAKE_CURRENT_BINARY_DIR} /share/xeus-cpp" )
37+ file (COPY "${XCPP_TAGCONFS_DIR} " DESTINATION "${CMAKE_CURRENT_BINARY_DIR} /etc/xeus-cpp" )
38+
3639# Versionning
3740# ===========
3841
Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ namespace xcpp
3232
3333 XEUS_CPP_API
3434 interpreter_ptr build_interpreter (int argc, char ** argv);
35+
36+ XEUS_CPP_API
37+ std::string retrieve_tagconf_dir ();
38+
39+ XEUS_CPP_API
40+ std::string retrieve_tagfile_dir ();
3541}
3642
3743#endif
Original file line number Diff line number Diff line change 1717
1818#include " xeus-cpp/xbuffer.hpp"
1919#include " xeus-cpp/xpreamble.hpp"
20+ #include " xeus-cpp/xutils.hpp"
2021
2122#include " xdemangle.hpp"
2223#include " xparser.hpp"
@@ -122,8 +123,8 @@ namespace xcpp
122123
123124 void inspect (const std::string& code, nl::json& kernel_res)
124125 {
125- std::string tagconf_dir = XCPP_TAGCONFS_DIR ;
126- std::string tagfiles_dir = XCPP_TAGFILES_DIR ;
126+ std::string tagconf_dir = retrieve_tagconf_dir () ;
127+ std::string tagfiles_dir = retrieve_tagfile_dir () ;
127128
128129 nl::json tagconfs = read_tagconfs (tagconf_dir.c_str ());
129130
Original file line number Diff line number Diff line change 2222#include < unistd.h>
2323#endif
2424
25+ #include " xeus/xsystem.hpp"
2526
2627#include " xeus-cpp/xutils.hpp"
2728#include " xeus-cpp/xinterpreter.hpp"
@@ -95,4 +96,41 @@ namespace xcpp
9596 return interp_ptr;
9697 }
9798
99+ std::string retrieve_tagconf_dir ()
100+ {
101+ const char * tagconf_dir_env = std::getenv (" XCPP_TAGCONFS_DIR" );
102+ if (tagconf_dir_env != nullptr )
103+ {
104+ return tagconf_dir_env;
105+ }
106+
107+ std::string prefix = xeus::prefix_path ();
108+
109+ #if defined(_WIN32)
110+ const char separator = ' \\ ' ;
111+ #else
112+ const char separator = ' /' ;
113+ #endif
114+
115+ return prefix + separator + " etc" + separator + " xeus-cpp" + separator + " tags.d" ;
116+ }
117+
118+ std::string retrieve_tagfile_dir ()
119+ {
120+ const char * tagfile_dir_env = std::getenv (" XCPP_TAGFILES_DIR" );
121+ if (tagfile_dir_env != nullptr )
122+ {
123+ return tagfile_dir_env;
124+ }
125+
126+ std::string prefix = xeus::prefix_path ();
127+
128+ #if defined(_WIN32)
129+ const char separator = ' \\ ' ;
130+ #else
131+ const char separator = ' /' ;
132+ #endif
133+
134+ return prefix + separator + " share" + separator + " xeus-cpp" + separator + " tagfiles" ;
135+ }
98136}
You can’t perform that action at this time.
0 commit comments