27inline bool IsWindows()
29 return std::strcmp(
gSystem->GetName(),
"WinNT") == 0;
33 return std::strcmp(
gSystem->GetName(),
"Macosx") == 0;
38std::string QuoteForShell(
const std::string &s)
46 std::replace(
q.begin(),
q.end(),
'"',
'\'');
47 return "\"" +
q +
"\"";
51 out.reserve(s.size() + 2);
64std::string GetEnvOrEmpty(
const char *
name)
66 if (
const char *
v = std::getenv(
name))
67 return std::string(
v);
72std::string MaybeBackground(std::string cmd)
82void edit(
const char *file)
84 const std::string
f = (file ? file :
"");
85 const std::string qf = QuoteForShell(
f);
86 const std::string editor = GetEnvOrEmpty(
"EDITOR");
93 cmd =
"start " + editor +
" " + qf;
95 cmd =
"start notepad " + qf;
99 cmd = MaybeBackground(editor +
" " + qf);
101 cmd = MaybeBackground(
"open -e " + qf);
105 cmd = MaybeBackground(editor +
" " + qf);
108 MaybeBackground(
"(command -v xdg-open >/dev/null 2>&1 && xdg-open " + qf +
") || (xterm -e vi " + qf +
")");
116void ls(
const char *path =
nullptr)
118 std::string cmd = IsWindows() ?
"dir /w" :
"ls";
121 cmd += QuoteForShell(path);
128void dir(
const char *path =
nullptr)
130 std::string cmd = IsWindows() ?
"dir" :
"ls -alF";
133 cmd += QuoteForShell(path);
142 static std::string wd;
143 wd =
gSystem->WorkingDirectory();
149const char *cd(
const char *path =
nullptr)
152 gSystem->ChangeDirectory(path);
166void bexec2(
const char *macro)
168 std::printf(
"in bexec dir=%s\n", pwd());
169 if (
gROOT->IsBatch())
170 std::printf(
"Processing benchmark: %s\n", macro);
180 if (
auto *tmacro = summary->GetLineWith(macro))
181 tmacro->SetTextColor(4);
190 if (
auto *tmacro2 = summary2->GetLineWith(macro))
191 tmacro2->SetTextColor(2);
R__EXTERN TSystem * gSystem
void Update() override
Update canvas pad buffers.
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
TObject * GetPrimitive(const char *name) const override
Get primitive.
A Pave (see TPave) with text, lines or/and boxes inside.