Save arbitrary file into TFile

Hi fellow rooters,
As usual, I’m not sure if this is going into the right forum. My question is, is it possible to save an arbitrary file into a TFile, which could then be regurgitated later? I thought that TSystemFile would be able to do this, but unless I am mistaken, it only contains reference info, rather than a full copy. What I would like would be some root class, say TSystemFileCopy, which I could use as, e.g.,

//Save the source code
system("tar -czf source_code.tgz src/ include/ Makefile");
//Now save it to the ROOT file
TSystemFileCopy f_source("source_code.tgz");
//Delete the temporary file
system("/bin/rm -f source_code.tgz");

Then the source_code.tgz file could be extracted from the TFile at any later point. I’ve come up with some rather inelegant hacks, such as storing the output of a cvs diff command into a text file and then using a TMacro to store it, but this would make life much easier, and would also work for someone without access to my cvs tree.

This is of course only my intended use; any arbitrary file which the user feels should be associated with the TFile could be stored in this manner.

One can of course simply tar everything together after the TFile is saved, but this way ensures that the program’s output can’t be separated from other critical files.

So I guess this may be more of a feature request than anything, unless I just missed this ability in the class lists.


What you request is currently not possible, in particular with object.Write
because the object written must be in memory and this cannot be assumed for any file in general. One possible solution could be to use a Tree
with as many entries as you have records of length L in the file.