Skip to content

Commit bc0e55a

Browse files
committed
Implemented new static method TROOT::GetTutorialsDir() to return the actual location of the tutorials in the installation (see ROOT-6477). Adapted some tutorials to make use of it.
1 parent fa7f1a1 commit bc0e55a

File tree

8 files changed

+29
-7
lines changed

8 files changed

+29
-7
lines changed

core/base/inc/TROOT.h

+1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ friend TROOT *ROOT::GetROOT2();
315315
static Int_t ConvertVersionInt2Code(Int_t v);
316316
static Int_t RootVersionCode();
317317
static const char**&GetExtraInterpreterArgs();
318+
static const char *GetTutorialsDir();
318319

319320
ClassDef(TROOT,0) //Top level (or root) structure for all classes
320321
};

core/base/src/TROOT.cxx

+13
Original file line numberDiff line numberDiff line change
@@ -2447,3 +2447,16 @@ const char**& TROOT::GetExtraInterpreterArgs() {
24472447
static const char** extraInterpArgs = 0;
24482448
return extraInterpArgs;
24492449
}
2450+
2451+
//______________________________________________________________________________
2452+
const char *TROOT::GetTutorialsDir()
2453+
{
2454+
// Get the tuorials directory in the installtion. Static utility function.
2455+
2456+
#ifdef ROOTTUTDIR
2457+
return ROOTTUTDIR;
2458+
#else
2459+
static TString tutdir = TString(gRootDir) + "/tutorials";
2460+
return tutdir;
2461+
#endif
2462+
}

core/doc/v604/index.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
## Core Libraries
22

3-
### Interpreter
4-
3+
<h4>Interpreter</h4>
4+
<p>
55
The new interface `TInterpreter::Declare(const char* code)` will declare the
66
code to the interpreter with all interpreter extensions disabled, i.e. as
77
"proper" C++ code. No autoloading or synamic lookup will be performed.
88

9+
<h4>TROOT</h4>
10+
<p>
11+
Implemented new gROOT->GetTutorialsDir() static method to return the actual location of the tutorials directory.
12+
This is $ROOTSYS/tutorials when not configuring with --prefix or -Dgnuinstall for CMake.

graf2d/asimage/src/TASImage.cxx

+2-2
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,11 @@ static void init_icon_paths()
389389
gIconPaths[3] = StrDup(guiIcons.Data());
390390

391391
#ifdef ROOTICONPATH
392-
gIconPaths[4] = ROOTICONPATH;
392+
gIconPaths[4] = StrDup(ROOTICONPATH);
393393
#endif
394394

395395
#ifdef EXTRAICONPATH
396-
gIconPaths[5] = EXTRAICONPATH;
396+
gIconPaths[5] = StrDup(EXTRAICONPATH);
397397
#endif
398398

399399
gIconPaths[6] = 0;

rootx/src/rootx.cxx

+2
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ static STRUCT_UTMP *SearchEntry(int n, const char *tty)
198198
return 0;
199199
}
200200

201+
#ifndef ROOTPREFIX
201202
static const char *GetExePath()
202203
{
203204
static std::string exepath;
@@ -244,6 +245,7 @@ static void SetRootSys()
244245
delete [] ep;
245246
}
246247
}
248+
#endif
247249

248250
static void SetDisplay()
249251
{

tutorials/io/mergeSelective.C

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void mergeSelective(Int_t nfiles=5)
3737
// Create the files to be merged
3838
TStopwatch timer;
3939
timer.Start();
40-
if (gROOT->LoadMacro("$ROOTSYS/tutorials/hsimple.C")) return;
40+
if (gROOT->LoadMacro(tutdir + "/hsimple.C")) return;
4141
Int_t i;
4242
for (i=0; i<nfiles; i++) CreateFile(Form("tomerge%03d.root",i));
4343

tutorials/io/testMergeCont.C

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ void testMergeCont()
66
{
77
// Macro to test merging of containers.
88

9-
gROOT->LoadMacro("$ROOTSYS/tutorials/hsimple.C");
9+
TString tutdir = gROOT->GetTutorialsDir();
10+
gROOT->LoadMacro(tutdir+"/hsimple.C");
1011
TList *list = (TList *)GetCollection();
1112
TList *inputs = new TList();
1213
for (Int_t i=0; i<10; i++) {

tutorials/tree/jets.C

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ void jets(Int_t nev=100, Int_t npileup=200, Bool_t secondrun = true) {
9090
//void jets(Int_t nev=100, Int_t npileup=200, Bool_t secondrun);
9191
void jets(Int_t nev=100, Int_t npileup=200) {
9292
gSystem->Load("libPhysics");
93-
gROOT->ProcessLine(".L $ROOTSYS/tutorials/tree/JetEvent.cxx+");
93+
TString tutdir = gROOT->GetTutorialsDir();
94+
gROOT->ProcessLine(".L " + tutdir + "/tree/JetEvent.cxx+");
9495
gROOT->ProcessLine("#define JETS_SECOND_RUN yes");
9596
gROOT->ProcessLine("#include \"" __FILE__ "\"");
9697
gROOT->ProcessLine("jets(100,200,true)");

0 commit comments

Comments
 (0)