Enable/disable TFile.Recover using a command (not .rootrc)

Hello,

I know practically nothing about TFile recovery system but reading the documentation of TFile.Recover (root.cern.ch/root/html/TFile.html#TFile:Recover) I see at the bottom:

[quote]

One can disable the automatic recovery procedure by setting
TFile.Recover 0
in the system.rootrc file[/quote]

Is it possible to enable/disable the TFile.Recover option also programatically, i.e. in runtime (without using a .rootrc file)? How can I do it?

Many thanks in advance for your answer.

Cheer,
Jiri

Hi,

Do gEnv->GetValue("TFile.Recover", 0); // or 1 to turn it on

Cheers,
Philippe.

Hi,

thanks a lot! This is what I was looking for. :slight_smile:

Cheers,
Jiri

hi,

what about in a compiled c++ code?

no luck with
TEnv env;
env.GetValue(“TFile.Recover”, 0);

cheers,
delo

Hi Delo,

The same, really. You need to manipulate the global variable gEnv:gEnv->SetValue("TFile.Recover", 0); // or 1 to turn it onbut it looks like due to a typo in the previous message say GetValue where SetValue was needed.

Cheers,
Philippe.

oh, right…

In general I don’t quite understand all these global variables such as
gROOT, gSystem etc.
when you run in compiled c++ code.
Ok, you define the object for example TSystem * syst = new TSystem()
and you play as in an interpred enviroment, but I don’t fully know
what I am doing…

cheers,
delo

Hi,

All the global variable/object (gROOT, gSystem, gEnv, etc.) that provide static services are prebuilt and you never need to allocate them (gSystem’s actually type depends on the platform for example).

Other variables that indicates/points to a state (like gDirectory and gFile) can be manipulated directly but will also be automatic updated (for example both are changed when you executed TFile *f = TFile::Open(…) to have the same value as ‘f’ which becomes the current directory).

Either way, to use them in compiled code, all you need to do is #include the corresponding header file.

Cheers,
Philippe.