1 #define ROOTHISTCNV_ROOTDIRFCN_CPP
9 #include "TDirectory.h"
13 namespace RootHistCnv {
23 while ( (p = full.find(
"/",i)) != -1) {
24 sdir = full.substr(i,p-i);
25 if (! gDirectory->GetKey(sdir.c_str()) ) {
28 gDirectory->cd(sdir.c_str());
32 gDirectory->cd( full.substr(i,full.length()-
i).c_str() );
45 std::string fil,cur,
s;
50 std::list<std::string> lpath;
53 if ( (p=full.find(
":",0)) != -1 ) {
54 fil = full.substr(0,p);
57 gDirectory->cd(fil.c_str());
60 while ( (p = full.find(
"/",i)) != -1) {
61 s = full.substr(i,p-i);
65 lpath.push_back( full.substr(i,full.length()-
i) );
67 if ( full.substr(0,1) ==
"/") {
71 std::list<std::string>::const_iterator litr;
72 for(litr=lpath.begin(); litr!=lpath.end(); ++litr) {
74 if (! gDirectory->GetKey(litr->c_str()) ) {
75 gDirectory->mkdir(litr->c_str());
77 gDirectory->cd(litr->c_str());
89 std::string dir = gDirectory->GetPath();
99 if (dir.substr(0,1) !=
"/") {
103 if (dir.substr(dir.length()-1,1) !=
"/") {
107 long ll = full.find(dir);
112 full.erase(0,dir.length()-1);
bool RootTrimLeadingDir(std::string &full, std::string dir)
bool RootMkdir(const std::string &full)
bool RootCd(const std::string &full)