Re: [ROOT] Request for iteration on TSystemDirectory

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Mon Mar 12 2001 - 21:49:38 MET


> Hi Valeri, 
> 
> > 
> > http://root.cern.ch/root/htmldoc/TFileSet.html
 
> > One can iterate it using 
> > 
> > http://root.cern.ch/root/htmldoc/TDataSetIter.html
> > 
> > the way you described.
> 
> Uh. When I do 
> 
>   root> gSystem->Load("libStar.so"); 
>   root> TString home("/home/group/user")
>   root> TFileSet myHome(home) 
> 
> it hangs! That is, nothing happens. ROOT/CINT doen't do anything (I
> let it sit there for at least ~30 minutes). Even if I do 
> 
>   root> TFileSet myhome("/home/group/user", "foo", kFALSE)
> 
> nothing (and I really mean nothing!) happens. What's up? 
> 

I still have no 3.00.06 locally. Mean time I tried 3.00.05 
and found no problem:

[rcf] ~/public/expert/root > root.exe -b
  *******************************************
  *                                         *
  *                                         *
  *   Version   3.00/05      5 March 2001   *
  *                                         *
  *                                         *
  *******************************************
root [0] gSystem->Load("libStar")    
(int)0
root [1] TString a("~/public/expert")
root [2] TFileSet fs(a)              
root [3] fs.ls(8)                    
  0 - expert    directory
  1 - expert/Jeff       directory
  2 - expert/Jeff/SavePrim.C    file
  2 - expert/Jeff/myTestFile.C  file
  1 - expert/C++Fun     directory


How deep is your ("/home/group/user") ?
Are you sure it is not running around the globe follow the symbolic 
links for example.It may take a while I think.
I have found  one has to protect this class against of "black hole deep"
directories.

 Some thing like this:

Replace ctor:

TFileSet(const TString &dirname,const Char_t *setname,Bool_t expand) 

with

TFileSet(const TString &dirname,const Char_t *setname,Bool_t expand, Int_t maxDeep=10) 
{
      if (!maxDeep) return;
     . . .


and  replace:

         Add(new TFileSet(nextdir,name,kFALSE));
with 
         Add(new TFileSet(nextdir,name,kFALSE,maxDeep-1));

 Thank you,
                                        Valeri



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:39 MET