#include <TString.h>
#include <TIterator.h>
#include <TList.h>
+#include <TSystem.h>
//AliRoot includes
//header
//
// Function to parse a configuration file
//
-
- ifstream file(cfgfile);
+ ResetMap();
+ ifstream file(gSystem->ExpandPathName(cfgfile));
if ( !file.is_open() ){
Error("ParseConfigFileTxt","File '%s' could not be opened!", cfgfile);
return 1;
//
//Get value for the speciefied key
//
- TObject *val=((TObjArray*)fConfigMap->FindObject(key))->At(position);
- if ( !val ) {
- return "";
- }
+ TObjArray *arr=((TObjArray*)fConfigMap->FindObject(key));
+ if (position>=(UInt_t)(arr->GetEntries())) return "";
+ TObject *val=arr->At(position);
+ if ( !val ) return "";
return (((TObjString*)val)->GetString()).Data();
}
//_____________________________________________________________________
//
//Get value for the speciefied key
//
- TObject *val=((TObjArray*)fConfigMap->FindObject(key))->At(position);
- if ( !val ) {
- return "";
- }
+ TObjArray *arr=((TObjArray*)fConfigMap->FindObject(key));
+ if (position>=((UInt_t)arr->GetEntries())) return "";
+ TObject *val=arr->At(position);
+ if ( !val ) return "";
return (((TObjString*)val)->GetString()).Data();
}
//_____________________________________________________________________