16#include "RConfigure.h"
44#include <crt_externs.h>
45#elif defined(__FreeBSD__)
54using namespace std::string_literals;
70 static std::map<std::string, std::unique_ptr<RWebDisplayHandle::Creator>>
sMap;
86 if (
libname ==
"ChromeCreator") {
87 m.emplace(
name, std::make_unique<ChromeCreator>(
name ==
"edge"));
88 }
else if (
libname ==
"FirefoxCreator") {
89 m.emplace(
name, std::make_unique<FirefoxCreator>());
90 }
else if (
libname ==
"SafariCreator") {
91 m.emplace(
name, std::make_unique<SafariCreator>());
92 }
else if (
libname ==
"BrowserCreator") {
93 m.emplace(
name, std::make_unique<BrowserCreator>(
false));
104 static std::unique_ptr<RWebDisplayHandle::Creator> dummy;
128 const std::string &dump)
144 gSystem->
Exec((
"taskkill /F /PID " + std::to_string(
fPid) +
" >NUL 2>NUL").c_str());
145 std::string rmdir =
"rmdir /S /Q ";
149 std::string rmdir =
"rm -rf ";
159 std::string
rmfile =
"del /F ";
161 std::string
rmfile =
"rm -f ";
180 if (exec.find(
"$url") == std::string::npos) {
183 fExec = exec +
" $url";
185 fExec = exec +
" $url &";
189 auto pos = exec.find(
" ");
190 if (pos != std::string::npos)
191 fProg = exec.substr(0, pos);
194 fExec =
"open \'$url\'";
196 fExec =
"start $url";
198 fExec =
"xdg-open \'$url\' &";
207 if (
nexttry.empty() || !fProg.empty())
212 fProg = std::regex_replace(
nexttry, std::regex(
"%20"),
" ");
225 if (pos != std::string::npos)
267std::unique_ptr<RWebDisplayHandle>
275 std::cout <<
"New web window: " <<
url << std::endl;
276 return std::make_unique<RWebBrowserHandle>(
url,
"",
"",
"");
283 exec = fHeadlessExec;
287 exec =
"$prog $url &";
297 ProcessGeometry(exec, args);
300 if (!extra.empty()) {
301 auto p = exec.find(
"$url");
302 if (
p != std::string::npos)
303 exec.insert(
p, extra +
" ");
311 if (((
url.find(
"token=") != std::string::npos) || (
url.find(
"key=") != std::string::npos)) && !args.
IsBatchMode() && !args.
IsHeadless()) {
314 auto f = TemporaryFile(
filebase, IsSnapBrowser() ? 1 : 0,
".html");
321 std::string
content = std::regex_replace(
323 "<html lang=\"en\">\n"
325 " <meta charset=\"utf-8\">\n"
326 " <meta http-equiv=\"refresh\" content=\"0;url=$url\"/>\n"
327 " <title>Opening ROOT widget</title>\n"
331 " This page should redirect you to a ROOT widget. If it doesn't,\n"
332 " <a href=\"$url\">click here to go to ROOT</a>.\n"
335 "</html>\n", std::regex(
"\\$url"),
url);
356 exec = std::regex_replace(exec, std::regex(
"\\$rootetcdir"),
TROOT::GetEtcDir().Data());
357 exec = std::regex_replace(exec, std::regex(
"\\$url"),
url);
358 exec = std::regex_replace(exec, std::regex(
"\\$width"),
swidth);
359 exec = std::regex_replace(exec, std::regex(
"\\$height"),
sheight);
360 exec = std::regex_replace(exec, std::regex(
"\\$posx"),
sposx);
361 exec = std::regex_replace(exec, std::regex(
"\\$posy"),
sposy);
363 if (exec.compare(0,5,
"fork:") == 0) {
386 std::vector<char *>
argv;
387 argv.push_back((
char *) fProg.c_str());
389 argv.push_back((
char *)
fargs->At(
n)->GetName());
390 argv.push_back(
nullptr);
392 R__LOG_DEBUG(0,
WebGUILog()) <<
"Show web window in browser with posix_spawn:\n" << fProg <<
" " << exec;
404#elif defined (__FreeBSD__)
452 if (
dump_content.find(
"<div>###batch###job###done###</div>") != std::string::npos)
485 if (
gEnv->
GetValue(
"WebGui.PreserveBatchFiles", -1) > 0)
486 ::Info(
"RWebDisplayHandle::Display",
"Preserve dump file %s",
redirect.c_str());
495 return std::make_unique<RWebBrowserHandle>(
url, rmdir,
tmpfile, pid);
507 exec =
"wmic process call create '"s +
gSystem->
UnixPathName(fProg.c_str()) +
" " + exec +
"' | find \"ProcessId\" "s;
523 return std::make_unique<RWebBrowserHandle>(
url, rmdir,
tmpfile, pid);
529 if (exec.rfind(
"&") == exec.length() - 1) {
532 exec.resize(exec.length() - 1);
534 std::vector<char *>
argv;
543 argv.push_back((
char *)
fargs->At(
n)->GetName());
544 argv.push_back(
nullptr);
550 return std::make_unique<RWebBrowserHandle>(
url, rmdir,
tmpfile,
""s);
558 std::string
prog = std::regex_replace(fProg, std::regex(
" "),
"\\ ");
560 std::string
prog = fProg;
565 exec = std::regex_replace(exec, std::regex(
"\\$prog"),
prog);
570 if (exec.find(
"$dumpfile") != std::string::npos) {
571 exec = std::regex_replace(exec, std::regex(
"\\$dumpfile"),
redirect);
573 auto p = exec.length();
574 if (exec.rfind(
"&") ==
p-1) --
p;
587 if (
gEnv->
GetValue(
"WebGui.PreserveBatchFiles", -1) > 0)
588 ::Info(
"RWebDisplayHandle::Display",
"Preserve dump file %s",
redirect.c_str());
632 TestProg(
"\\Microsoft\\Edge\\Application\\msedge.exe",
true);
634 TestProg(
"\\Google\\Chrome\\Application\\chrome.exe",
true);
637 TestProg(
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
642 TestProg(
"/usr/bin/chromium-browser");
643 TestProg(
"/usr/bin/chrome-browser");
644 TestProg(
"/usr/bin/google-chrome-stable");
666 fBatchExec =
gEnv->
GetValue((
fEnvPrefix +
"Batch").c_str(),
"fork:--headless --no-sandbox --disable-extensions --disable-audio-output $geometry --dump-dom $url");
670 fBatchExec =
gEnv->
GetValue((
fEnvPrefix +
"Batch").c_str(),
"fork:--headless=new --no-sandbox --disable-extensions --disable-audio-output $geometry --dump-dom $url");
673 fExec =
gEnv->
GetValue((
fEnvPrefix +
"Interactive").c_str(),
"$prog $geometry --new-window --app=\'$url\' >/dev/null 2>/dev/null &");
684 std::string geometry;
686 geometry =
"--window-size="s + std::to_string(args.
GetWidth())
693 std::to_string(args.
GetY() >= 0 ? args.
GetY() : 0));
696 exec = std::regex_replace(exec, std::regex(
"\\$geometry"), geometry);
707 if (exec.find(
"$profile") == std::string::npos)
717 if ((
profile_arg.compare(0, 4,
"/tmp") == 0) && IsSnapBrowser())
727 profile_arg +=
"root_chrome_profile_"s + std::to_string(
rnd.Integer(0x100000));
732 exec = std::regex_replace(exec, std::regex(
"\\$profile"),
profile_arg);
746 TestProg(
"\\Mozilla Firefox\\firefox.exe",
true);
749 TestProg(
"/Applications/Firefox.app/Contents/MacOS/firefox");
762 fExec =
gEnv->
GetValue(
"WebGui.FirefoxInteractive",
"$prog -no-remote $profile $geometry $url &");
764 fBatchExec =
gEnv->
GetValue(
"WebGui.FirefoxBatch",
"fork:--headless -no-remote -new-instance $profile $url");
766 fExec =
gEnv->
GetValue(
"WebGui.FirefoxInteractive",
"$rootetcdir/runfirefox.sh __nodump__ $cleanup_profile $prog -no-remote $profile $geometry -url \'$url\' &");
775 std::string geometry;
777 geometry =
"-width="s + std::to_string(args.
GetWidth()) +
" -height=" + std::to_string(args.
GetHeight());
779 exec = std::regex_replace(exec, std::regex(
"\\$geometry"), geometry);
789 if (exec.find(
"$profile") == std::string::npos)
803 if ((
profile_dir.compare(0, 4,
"/tmp") == 0) && IsSnapBrowser())
813 profile_dir +=
"root_ff_profile_"s + std::to_string(
rnd.Integer(0x100000));
823 user_js <<
"user_pref(\"datareporting.policy.dataSubmissionPolicyBypassNotification\", true);" << std::endl;
824 user_js <<
"user_pref(\"datareporting.policy.dataSubmissionPolicyAcceptedVersion\", 2);" << std::endl;
825 user_js <<
"user_pref(\"datareporting.policy.dataSubmissionPolicyNotifiedTime\", \"1635760572813\");" << std::endl;
828 user_js <<
"user_pref(\"app.update.auto\", false);" << std::endl;
829 user_js <<
"user_pref(\"browser.shell.checkDefaultBrowser\", false);" << std::endl;
830 user_js <<
"user_pref(\"browser.aboutwelcome.enabled\", false);" << std::endl;
831 user_js <<
"user_pref(\"browser.tabs.disableBackgroundLinkLoading\", true);" << std::endl;
834 user_js <<
"user_pref(\"browser.tabs.closeWindowWithLastTab\", true);" << std::endl;
835 user_js <<
"user_pref(\"dom.allow_scripts_to_close_windows\", true);" << std::endl;
836 user_js <<
"user_pref(\"browser.sessionstore.resume_from_crash\", false);" << std::endl;
840 user_js <<
"user_pref(\"browser.dom.window.dump.enabled\", true);" << std::endl;
843 user_js <<
"user_pref(\"datareporting.policy.firstRunURL\", \"\");" << std::endl;
845 user_js <<
"user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", true);" << std::endl;
847 user_js <<
"user_pref(\"browser.tabs.inTitlebar\", 0);" << std::endl;
851 user_js <<
"user_pref(\"webgl.out-of-process\", false);" << std::endl;
856 times_json <<
" \"created\": 1699968480952," << std::endl;
857 times_json <<
" \"firstUse\": null" << std::endl;
860 std::ofstream
style(
profile_dir +
"/chrome/userChrome.css", std::ios::trunc);
862 style <<
"#TabsToolbar { visibility: collapse; }" << std::endl;
864 style <<
"#nav-bar, #urlbar-container, #searchbar { visibility: collapse !important; }" << std::endl;
873 exec = std::regex_replace(exec, std::regex(
"\\$profile"),
profile_arg);
875 if (exec.find(
"$cleanup_profile") != std::string::npos) {
876 if (rmdir.empty()) rmdir =
"__dummy__";
877 exec = std::regex_replace(exec, std::regex(
"\\$cleanup_profile"), rmdir);
898 if (
qt6 &&
qt6->IsActive())
903 if (
cef &&
cef->IsActive())
920 std::unique_ptr<RWebDisplayHandle> handle;
925 auto try_creator = [&](std::unique_ptr<Creator> &creator) {
926 if (!creator || !creator->IsActive())
928 handle = creator->Display(args);
929 return handle ?
true :
false;
992 std::unique_ptr<Creator> creator = std::make_unique<BrowserCreator>(
false, args.
GetCustomExec());
1036 if (
h1 &&
h1->IsActive()) {
1042 auto &h2 =
FindCreator(
"firefox",
"FirefoxCreator");
1043 if (h2 && h2->IsActive()) {
1054 return h1 &&
h1->IsActive();
1058 auto &h2 =
FindCreator(
"firefox",
"FirefoxCreator");
1059 return h2 && h2->IsActive();
1065 return h3 &&
h3->IsActive();
1137 std::vector<std::string>
fnames;
1139 if ((
fmt ==
"s.pdf") || (
fmt ==
"s.png")) {
1147 farg.insert(
farg.rfind(
"."),
"%d");
1184 std::vector<std::string>
fmts;
1199 for (
unsigned n = 0; (
n <
fmts.size()) && (
n <
jsons.size());
n++) {
1200 if (
fmts[
n] ==
"json") {
1206 }
else if (
fmts[
n] ==
"html") {
1217 ofs <<
"<!DOCTYPE html>\n"
1218 "<html lang=\"en\">\n"
1220 " <meta charset=\"utf-8\">\n"
1221 " <title>Dsiplay of ROOT " << (
is_multi_html ?
"objects" :
"object") <<
"</title>\n"
1222 " <link rel=\"shortcut icon\" href=\"" <<
filejsrootsys <<
"/img/RootIcon.ico\"/>\n"
1223 " <script type=\"importmap\">\n"
1224 " { \"imports\": { \"jsroot\": \"" <<
filejsrootsys <<
"/modules/main.mjs\" } }\n"
1228 ofs <<
" .root-container {\n"
1230 " flex-direction: column;\n"
1231 " align-items: center;\n"
1240 " justify-content: center;\n"
1241 " align-items: center;\n"
1242 " min-height: 100vh;\n"
1243 " background-color: #f0f0f0;\n"
1246 ofs <<
" .root-drawing {\n"
1247 " background-color: white;\n"
1248 " box-shadow: 0 4px 10px rgba(0,0,0,0.1);\n"
1254 ofs <<
" <div class=\"root-container\">\n";
1255 for (
unsigned k = 0; k <
jsons.size(); ++k)
1256 ofs <<
" <div id=\"drawing" << k <<
"\" class=\"root-drawing\""
1257 " style=\"width: " <<
widths[k] <<
"px;"
1258 " height: " <<
heights[k] <<
"px;\"></div>\n";
1261 ofs <<
" <div id=\"drawing\" class=\"root-drawing\""
1262 " style=\"width: " <<
widths[
n] <<
"px;"
1263 " min-height: " <<
heights[
n] <<
"px;\"></div>\n";
1265 ofs <<
" <script type=\"module\">\n"
1266 " import { parse, draw } from \"jsroot\";\n";
1268 for (
unsigned k = 0; k <
jsons.size(); ++k) {
1269 ofs <<
" const obj" << k <<
" = parse(" <<
jsons[k] <<
");\n"
1270 " draw(\"drawing" << k <<
"\", obj" << k <<
");\n";
1273 ofs <<
" const obj = parse(" <<
jsons[
n] <<
");\n"
1274 " draw(\"drawing\", obj);\n";
1276 ofs <<
" </script>\n"
1280 ::Info(
"ProduceImages",
"HTML file %s size %d bytes has been created",
fnames[
n].c_str(), (
int)
ofs.tellp());
1285 }
else if (!
fmts[
n].empty())
1334 if (
fmts[0] ==
"s.png") {
1336 R__LOG_ERROR(
WebGUILog()) <<
"Direct png image creation supported only by Chrome and Firefox browsers";
1341 }
else if (
fmts[0] ==
"s.pdf") {
1380 std::string
mains, prev;
1384 mains.append(
"'same'");
1395 static std::string
jsroot_include =
"<script id=\"jsroot\" src=\"$jsrootsys/build/jsroot.js\"></script>";
1397 if (
p != std::string::npos) {
1428 fputs(
"placeholder", df);
1473 if (
fmts[0] ==
"s.pdf")
1507 if (
gEnv->
GetValue(
"WebGui.PreserveBatchFiles", -1) > 0)
1525 if (
fmts[0] ==
"s.pdf")
1526 ::Info(
"ProduceImages",
"PDF file %s with %d pages has been created",
fnames[0].c_str(), (
int)
jsons.size());
1530 ::Info(
"ProduceImages",
"PNG file %s with %d pages has been created",
fnames[0].c_str(), (
int)
jsons.size());
1533 auto dumpcont = handle->GetContent();
1538 R__LOG_INFO(
WebGUILog()) <<
"Use home directory for running chrome in batch, set TMPDIR for preferable temp directory";
1548 std::string::size_type
p = 0;
1550 for (
unsigned n = 0;
n <
fmts.size();
n++) {
1551 if (
fmts[
n].empty())
1553 if (
fmts[
n] ==
"svg") {
1558 if ((
p1 != std::string::npos) && (
p2 != std::string::npos) && (
p1 <
p2)) {
1561 ::Info(
"ProduceImages",
"Image file %s size %d bytes has been created",
fnames[
n].c_str(), (
int) (
p2 -
p1 + 1));
1563 ::Error(
"ProduceImages",
"Failure producing %s",
fnames[
n].c_str());
1572 if ((
p0 != std::string::npos) && (
p1 != std::string::npos) && (
p2 != std::string::npos) && (
p1 <
p2)) {
1575 ::Error(
"ProduceImages",
"Failure producing %s",
fnames[
n].c_str());
1578 std::ofstream
ofs(
fnames[
n], std::ios::binary);
1580 ::Info(
"ProduceImages",
"Image file %s size %d bytes has been created",
fnames[
n].c_str(), (
int)
binary.Length());
1583 ::Error(
"ProduceImages",
"Failure producing %s",
fnames[
n].c_str());
#define R__LOG_ERROR(...)
#define R__LOG_DEBUG(DEBUGLEVEL,...)
static void DummyTimeOutHandler(int)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
winID h TVirtualViewer3D TVirtualGLPainter p
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 length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
R__EXTERN TSystem * gSystem
const_iterator begin() const
const_iterator end() const
Specialized handle to hold information about running browser process Used to correctly cleanup all pr...
RWebBrowserHandle(const std::string &url, const std::string &tmpdir, const std::string &tmpfile, browser_process_id pid)
std::string fTmpDir
temporary directory to delete at the end
void RemoveStartupFiles() override
remove file which was used to startup widget - if possible
RWebBrowserHandle(const std::string &url, const std::string &tmpdir, const std::string &tmpfile, const std::string &dump)
std::string fTmpFile
temporary file to remove
~RWebBrowserHandle() override
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
std::string GetBrowserName() const
Returns configured browser name.
EBrowserKind GetBrowserKind() const
returns configured browser kind, see EBrowserKind for supported values
const std::string & GetRedirectOutput() const
get file name to which web browser output should be redirected
void SetStandalone(bool on=true)
Set standalone mode for running browser, default on When disabled, normal browser window (or just tab...
void SetBatchMode(bool on=true)
set batch mode
RWebDisplayArgs & SetSize(int w, int h)
set preferable web window width and height
RWebDisplayArgs & SetUrl(const std::string &url)
set window url
int GetWidth() const
returns preferable web window width
RWebDisplayArgs & SetPageContent(const std::string &cont)
set window url
int GetY() const
set preferable web window y position
std::string GetFullUrl() const
returns window url with append options
bool IsStandalone() const
Return true if browser should runs in standalone mode.
int GetHeight() const
returns preferable web window height
RWebDisplayArgs & SetBrowserKind(const std::string &kind)
Set browser kind as string argument.
std::string GetCustomExec() const
returns custom executable to start web browser
void SetExtraArgs(const std::string &args)
set extra command line arguments for starting web browser command
bool IsBatchMode() const
returns batch mode
bool IsHeadless() const
returns headless mode
@ kOn
web display enable, first try use embed displays like Qt or CEF, then native browsers and at the end ...
@ kFirefox
Mozilla Firefox browser.
@ kNative
either Chrome or Firefox - both support major functionality
@ kLocal
either CEF or Qt5 - both runs on local display without real http server
@ kServer
indicates that ROOT runs as server and just printouts window URL, browser should be started by the us...
@ kOff
disable web display, do not start any browser
@ kCEF
Chromium Embedded Framework - local display with CEF libs.
@ kQt6
Qt6 QWebEngine libraries - Chromium code packed in qt6.
@ kCustom
custom web browser, execution string should be provided
@ kChrome
Google Chrome browser.
@ kEdge
Microsoft Edge browser (Windows only)
void SetRedirectOutput(const std::string &fname="")
specify file name to which web browser output should be redirected
void SetHeadless(bool on=true)
set headless mode
const std::string & GetExtraArgs() const
get extra command line arguments for starting web browser command
int GetX() const
set preferable web window x position
bool IsLocalDisplay() const
returns true if local display like CEF or Qt5 QWebEngine should be used
std::string fProg
browser executable
std::string fBatchExec
batch execute line
std::string fHeadlessExec
headless execute line
static FILE * TemporaryFile(TString &name, int use_home_dir=0, const char *suffix=nullptr)
Create temporary file for web display Normally gSystem->TempFileName() method used to create file in ...
std::unique_ptr< RWebDisplayHandle > Display(const RWebDisplayArgs &args) override
Display given URL in web browser.
std::string fExec
standard execute line
void TestProg(const std::string &nexttry, bool check_std_paths=false)
Check if browser executable exists and can be used.
BrowserCreator(bool custom=true, const std::string &exec="")
Class to handle starting of web-browsers like Chrome or Firefox.
ChromeCreator(bool is_edge=false)
Constructor.
void ProcessGeometry(std::string &, const RWebDisplayArgs &) override
Replace $geometry placeholder with geometry settings Also RWebDisplayArgs::GetExtraArgs() are appende...
std::string MakeProfile(std::string &exec, bool) override
Handle profile argument.
FirefoxCreator()
Constructor.
std::string MakeProfile(std::string &exec, bool batch) override
Create Firefox profile to run independent browser window.
void ProcessGeometry(std::string &, const RWebDisplayArgs &) override
Process window geometry for Firefox.
bool IsActive() const override
Returns true if it can be used.
SafariCreator()
Constructor.
Handle of created web-based display Depending from type of web display, holds handle of started brows...
static std::map< std::string, std::unique_ptr< Creator > > & GetMap()
Static holder of registered creators of web displays.
static bool CheckIfCanProduceImages(RWebDisplayArgs &args)
Checks if configured browser can be used for image production.
static bool ProduceImages(const std::string &fname, const std::vector< std::string > &jsons, const std::vector< int > &widths, const std::vector< int > &heights, const char *batch_file=nullptr)
Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless brow...
static std::vector< std::string > ProduceImagesNames(const std::string &fname, unsigned nfiles=1)
Produce vector of file names for specified file pattern Depending from supported file formats.
static std::string GetImageFormat(const std::string &fname)
Detect image format There is special handling of ".screenshot.pdf" and ".screenshot....
void SetContent(const std::string &cont)
set content
static bool ProduceImage(const std::string &fname, const std::string &json, int width=800, int height=600, const char *batch_file=nullptr)
Produce image file using JSON data as source Invokes JSROOT drawing functionality in headless browser...
static bool CanProduceImages(const std::string &browser="")
Returns true if image production for specified browser kind is supported If browser not specified - u...
static bool NeedHttpServer(const RWebDisplayArgs &args)
Check if http server required for display.
static bool DisplayUrl(const std::string &url)
Display provided url in configured web browser.
static std::unique_ptr< RWebDisplayHandle > Display(const RWebDisplayArgs &args)
Create web display.
static std::unique_ptr< Creator > & FindCreator(const std::string &name, const std::string &libname="")
Search for specific browser creator If not found, try to add one.
static int GetBoolEnv(const std::string &name, int dfl=-1)
Parse boolean gEnv variable which should be "yes" or "no".
static TString Decode(const char *data)
Decode a base64 string date into a generic TString.
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)
@ kNoSpaces
no new lines plus remove all spaces around "," and ":" symbols
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
static char * ReadFileContent(const char *filename, Int_t &len)
Reads content of file from the disk.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
static const TString & GetDataDir()
Get the data directory in the installation. Static utility function.
Random number generator class based on M.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
virtual FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr)
Create a secure temporary file by appending a unique 6 letter string to base.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual const char * Getenv(const char *env)
Get environment variable.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual std::string GetHomeDirectory(const char *userName=nullptr) const
Return the user's home directory.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
virtual int Rename(const char *from, const char *to)
Rename a file.
virtual TString GetFromPipe(const char *command, Int_t *ret=nullptr, Bool_t redirectStderr=kFALSE)
Execute command and return output in TString.
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual const char * WorkingDirectory()
Return working directory.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
virtual int Unlink(const char *name)
Unlink, i.e.
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
bool EndsWith(std::string_view string, std::string_view suffix)
ROOT::RLogChannel & WebGUILog()
Log channel for WebGUI diagnostics.