21#include <RConfigure.h>
36namespace FoundationUtils {
39 char fixedLength[1024];
40 char *currWorkDir = fixedLength;
42 char *
result = currWorkDir;
47 if (fixedLength != currWorkDir) {
50 currWorkDir =
new char[
len];
57 }
while (!
result && errno == ERANGE);
59 std::string
output = currWorkDir;
66 if (fixedLength != currWorkDir) {
72std::string
MakePathRelative(
const std::string &path,
const std::string &base,
bool isBuildingROOT )
76 const char *currWorkDir = base.c_str();
77 size_t lenCurrWorkDir = strlen(currWorkDir);
78 if (
result.substr(0, lenCurrWorkDir) == currWorkDir) {
82 result.erase(0, lenCurrWorkDir);
88 int posInc =
result.find(
"/inc/");
98 std::replace(Path.begin(), Path.end(),
'\\',
'/');
102 static std::string fallback;
103 if (!fallback.empty())
106 static char lpFilename[_MAX_PATH];
107 if (::GetModuleFileNameA(
110 sizeof(lpFilename))) {
111 auto parent_path = [](std::string path) {
112 return path.substr(0, path.find_last_of(
"/\\"));
114 fallback = parent_path(parent_path(lpFilename));
120 fallback =
"/usr/local/root";
126static bool IgnorePrefix() {
127 static bool ignorePrefix = ::getenv(
"ROOTIGNOREPREFIX");
134 if (!IgnorePrefix()) {
135 const static std::string rootsys = ROOTPREFIX;
139 static std::string rootsys;
140 if (rootsys.empty()) {
141 if (
const char* envValue = ::getenv(
"ROOTSYS")) {
156 if (!IgnorePrefix()) {
157 const static std::string rootincdir = ROOTINCDIR;
161 static std::string rootincdir;
162 if (rootincdir.empty()) {
164 rootincdir =
GetRootSys() + sep +
"include" + sep;
171 if (!IgnorePrefix()) {
172 const static std::string rootetcdir = ROOTETCDIR;
177 const static std::string rootetcdir =
183 std::transform(s.begin(), s.end(), s.begin(),
184 [](
unsigned char c){ return std::tolower(c); });
The file contains utilities which are foundational and could be used across the core component of ROO...
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
static int lowercase(const char *s)
const std::string & GetPathSeparator()
const std::string & GetIncludeDir()
\ returns the include directory in the installation.
std::string GetCurrentDir()
static std::string str_tolower(std::string s)
void ConvertToUnixPath(std::string &Path)
Transforms a file path by replacing its backslashes with slashes.
bool CanConvertEnvValueToBool(const std::string &value)
const std::string & GetRootSys()
std::string MakePathRelative(const std::string &path, const std::string &base, bool isBuildingROOT=false)
bool ConvertEnvValueToBool(const std::string &value)
const std::string & GetFallbackRootSys()
const std::string & GetEtcDir()
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.