21#include <RConfigure.h> 
   35namespace FoundationUtils {
 
   38   char fixedLength[1024];
 
   39   char *currWorkDir = fixedLength;
 
   41   char *result = currWorkDir;
 
   46         if (fixedLength != currWorkDir) {
 
   49         currWorkDir = 
new char[len];
 
   52      result = ::_getcwd(currWorkDir, len);
 
   54      result = getcwd(currWorkDir, len);
 
   56   } 
while (result == 0 && errno == ERANGE);
 
   58   std::string 
output = currWorkDir;
 
   65   if (fixedLength != currWorkDir) {
 
   71std::string 
MakePathRelative(
const std::string &path, 
const std::string &base, 
bool isBuildingROOT )
 
   73   std::string result(path);
 
   75   const char *currWorkDir = base.c_str();
 
   76   size_t lenCurrWorkDir = strlen(currWorkDir);
 
   77   if (result.substr(0, lenCurrWorkDir) == currWorkDir) {
 
   81      result.erase(0, lenCurrWorkDir);
 
   87      int posInc = result.find(
"/inc/");
 
   89         result =  result.substr(posInc + 5, -1);
 
   97   std::replace(Path.begin(), Path.end(), 
'\\', 
'/');
 
  101   static std::string fallback;
 
  102   if (!fallback.empty())
 
  105   static char lpFilename[_MAX_PATH];
 
  106   if (::GetModuleFileNameA(
 
  109          sizeof(lpFilename))) {  
 
  110      auto parent_path = [](std::string path) {
 
  111         return path.substr(0, path.find_last_of(
"/\\"));
 
  113      fallback = parent_path(parent_path(lpFilename));
 
  119   fallback = 
"/usr/local/root";
 
  125static bool IgnorePrefix() {
 
  126   static bool ignorePrefix = ::getenv(
"ROOTIGNOREPREFIX");
 
  133   if (!IgnorePrefix()) {
 
  134      const static std::string rootsys = ROOTPREFIX;
 
  138   static std::string rootsys;
 
  139   if (rootsys.empty()) {
 
  140      if (
const char* envValue = ::getenv(
"ROOTSYS")) {
 
  155   if (!IgnorePrefix()) {
 
  156      const static std::string rootincdir = ROOTINCDIR;
 
  160   static std::string rootincdir;
 
  161   if (rootincdir.empty()) {
 
  170   if (!IgnorePrefix()) {
 
  171      const static std::string rootetcdir = ROOTETCDIR;
 
  176   const static std::string rootetcdir =
 
The file contains utilities which are foundational and could be used across the core component of ROO...
 
const std::string & GetPathSeparator()
 
const std::string & GetIncludeDir()
\ returns the include directory in the installation.
 
std::string GetCurrentDir()
 
void ConvertToUnixPath(std::string &Path)
Transforms a file path by replacing its backslashes with slashes.
 
const std::string & GetRootSys()
 
std::string MakePathRelative(const std::string &path, const std::string &base, bool isBuildingROOT=false)
 
const std::string & GetFallbackRootSys()
 
const std::string & GetEtcDir()
 
static void output(int code)