|
1 | 1 | #include "TestHelpers.h" |
2 | 2 | #include "TestOutput.h" |
3 | | -#include "TSystem.h" |
4 | | -#include "TList.h" |
5 | | -#include "TRegexp.h" |
6 | | -#include "TObjString.h" |
7 | | -#include <utility> |
8 | 3 |
|
9 | | -void fillListOfDir(const TString &directory, TList &l) { |
10 | | - |
11 | | - void *dir = gSystem->OpenDirectory(directory); |
12 | | - |
13 | | - const char *file = 0; |
14 | | - if (dir) { |
15 | | - |
16 | | - //create a TList to store the file names (not yet sorted) |
17 | | - TString basename = ".-..-.."; |
18 | | - TRegexp re(basename,kFALSE); |
19 | | - |
20 | | - while ((file = gSystem->GetDirEntry(dir))) { |
21 | | - if (!strcmp(file,".") || !strcmp(file,"..")) continue; |
22 | | - // Skip 'latest' as it is a symlink |
23 | | - if (strcmp(file,"latest")==0) continue; |
24 | | - |
25 | | - TString s = file; |
26 | | - if ( (basename!=file) && s.Index(re) == kNPOS) continue; |
27 | | - |
28 | | - TString dirname = file; |
29 | | - if (directory != ".") { |
30 | | - auto _dirname = gSystem->ConcatFileName(directory, file); |
31 | | - dirname = _dirname; |
32 | | - delete [] _dirname; |
33 | | - } |
34 | | - |
35 | | - auto _vfile = gSystem->ConcatFileName(dirname, "vector.root"); |
36 | | - TString vfile = _vfile; |
37 | | - delete [] _vfile; |
38 | | - |
39 | | - if (gSystem->GetPathInfo(vfile,(Long_t*)0,(Long_t*)0,(Long_t*)0,0)==0) { |
40 | | - l.Add(new TObjString(dirname)); |
41 | | - } else { |
42 | | -// cout << "did not find vector in " << file << endl; |
43 | | - } |
44 | | - |
45 | | - } |
46 | | - gSystem->FreeDirectory(dir); |
47 | | - |
48 | | - } |
49 | | -} |
50 | | - |
51 | | -void fillListOfDir(TList &l) { |
52 | | - fillListOfDir(".", l); |
53 | | - fillListOfDir("ArchivedDataFiles", l); |
54 | | - const char *otherdir = gSystem->Getenv("ROOT_NEWSTL_DATAFILE_DIR"); |
55 | | - if (otherdir && otherdir[0]) |
56 | | - fillListOfDir(otherdir, l); |
57 | | - |
58 | | - // Sort the files in alphanumeric order |
59 | | - l.Sort(); |
60 | | - |
61 | | - if (gDebug > 3) { |
62 | | - TIter next(&l); |
63 | | - TObjString *obj; |
64 | | - while ((obj = (TObjString*)next())) { |
65 | | - const char *file = obj->GetName(); |
66 | | - cout << "found the directory " << file << endl; |
67 | | - } |
68 | | - } |
69 | | -} |
70 | 4 |
|
71 | 5 | #ifdef __MAKECINT__ |
72 | 6 | #pragma link C++ function DebugTest; |
|
0 commit comments