8 #include "TObjString.h"
10 #include "Riostream.h"
12 #include "KVUniqueNameList.h"
60 if (!FindExecutable(fexec)) {
85 if (fcmd ==
"")
return -1;
86 return gSystem->Exec(fcmd.Data());
100 if (fcmd ==
"")
return TString(
"");
101 fout = gSystem->GetFromPipe(fcmd.Data());
116 return (line.BeginsWith(
"C-"));
136 Error(
"GetListing",
"Unknown directory %s", directory);
140 TObjArray* toks = fout.Tokenize(
"\n");
143 list->SetName(((TObjString*)(*toks)[0])->String().Remove(TString::kBoth,
' ').Data());
144 for (
int i = 1; i < toks->GetEntries(); i++) {
145 TString tmp = ((TObjString*)(*toks)[i])->String().
Remove(TString::kBoth,
' ');
147 if (IsContainer(tmp)) {
148 f->SetName(gSystem->BaseName(tmp.Data()));
152 ExtractFileInfos(tmp, f);
171 TString filename = gSystem->BaseName(path);
172 TString dirname = gSystem->DirName(path);
173 if (DirectoryContains(filename.Data(), dirname.Data())) {
175 fout.Remove(TString::kBoth,
' ');
176 fs.SetName(filename.Data());
177 if (IsContainer(fout)) {
181 ExtractFileInfos(fout, &fs);
203 Error(
"GetListing",
"Unknown directory %s", directory);
207 TObjArray* toks = fout.Tokenize(
"\n");
208 TList* list =
new TList;
209 list->SetOwner(kTRUE);
210 list->SetName(((TObjString*)(*toks)[0])->String().Remove(TString::kBoth,
' ').Data());
211 for (
int i = 1; i < toks->GetEntries(); i++) {
212 TString tmp = ((TObjString*)(*toks)[i])->String().Remove(TString::kBoth,
' ');
214 if (IsContainer(tmp)) {
215 f->SetName(gSystem->BaseName(tmp.Data()));
219 f->SetName(tmp.Data());
238 TList* list = GetListing(directory);
241 Bool_t ok = list->FindObject(name);
263 TROOT::IndentLevel();
265 cout << GetName() <<
"/" << endl;
267 cout << GetName() <<
"\t" << GetSize() <<
"\t" << GetModTime().AsString() << endl;
void SetIsContainer(Bool_t yes=kTRUE)
Base class for KaliVeda framework.
Abstract base class for interfaces to Data Management Systems (SRB, IRODS, etc.)
virtual Bool_t GetPathInfo(const Char_t *path, DMSFile_t &fs)
virtual Bool_t DirectoryContains(const Char_t *name, const Char_t *directory="")
virtual TList * GetListing(const Char_t *directory="")
Bool_t buildCommand(const Char_t *scmd, const Char_t *args="", Option_t *opts="")
virtual Bool_t IsContainer(TString &) const
virtual KVUniqueNameList * GetFullListing(const Char_t *directory="")
virtual void SetOwner(Bool_t enable=kTRUE)
virtual TObject * Remove(TObject *obj)
Remove object from list.
Optimised list in which named objects can only be placed once.
virtual void Add(TObject *obj)