16 void importdir(
const char *dirname) {
17 char *slash = (
char*)strrchr(dirname,
'/');
19 if (slash) locdir = slash+1;
20 else locdir = (
char*)dirname;
21 printf(
"processing dir %s\n",dirname);
22 TDirectory *savdir = gDirectory;
23 TDirectory *adir = savdir->mkdir(locdir);
25 void *dirp = gSystem->OpenDirectory(dirname);
28 Long_t id, size,flags,modtime;
30 while ((direntry=(
char*)gSystem->GetDirEntry(dirp))) {
31 TString afile = Form(
"%s/%s",dirname,direntry);
32 gSystem->GetPathInfo(afile,&
id,&size,&flags,&modtime);
33 if (direntry[0] ==
'.')
continue;
34 if (!strcmp(direntry,
"CVS"))
continue;
35 if (!strcmp(direntry,
"htmldoc"))
continue;
36 if (strstr(dirname,
"root/include"))
continue;
37 if (strstr(direntry,
"G__"))
continue;
38 if (strstr(direntry,
".c") ||
39 strstr(direntry,
".h") ||
40 strstr(direntry,
".dat") ||
41 strstr(direntry,
".py") ||
42 strstr(direntry,
".C")) {
43 TMacro *m =
new TMacro(afile);
47 if (flags != 3)
continue;
52 gSystem->FreeDirectory(dirp);
56 TFile *f =
new TFile(
"code.root",
"recreate");
57 TString dir = gROOT->GetTutorialDir();
58 importdir(gSystem->UnixPathName(dir.Data()));