1 #define ROOTHISTCNV_ROOTDIRFCN_CPP
3 #include "GaudiKernel/Kernel.h"
9 #include "TDirectory.h"
22 while ( (p = full.find(
"/",i)) != -1) {
23 auto sdir = full.substr(i,p-i);
24 if (! gDirectory->GetKey(sdir.c_str()) ) {
27 gDirectory->cd(sdir.c_str());
30 gDirectory->cd( full.substr(i).c_str() );
41 TDirectory *gDir = gDirectory;
44 auto p=full.find(
":",0);
45 if ( p != std::string::npos ) {
46 auto fil = full.substr(0,p);
49 gDirectory->cd(fil.c_str());
52 std::vector<std::string> lpath;
53 while ( (p = full.find(
"/",i)) != std::string::npos ) {
54 lpath.push_back(full.substr(i,p-i));
57 lpath.push_back( full.substr(i) );
59 if ( full.compare(0,1,
"/") == 0 ) gDirectory->cd(
"/");
61 for(
const auto& lp : lpath) {
62 if (! gDirectory->GetKey(lp.c_str()) ) {
63 gDirectory->mkdir(lp.c_str());
65 gDirectory->cd(lp.c_str());
76 std::string dir = gDirectory->GetPath();
86 if (dir.compare(0,1,
"/") != 0) {
90 if (dir.compare(dir.length()-1,1,
"/") != 0) {
94 long ll = full.find(dir);
99 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)