11 #define ROOTHISTCNV_ROOTDIRFCN_CPP
16 #include <TDirectory.h>
29 gDirectory->cd(
"/" );
30 while ( ( p = full.find(
"/", i ) ) != -1 ) {
31 auto sdir = full.substr( i, p - i );
32 if ( !gDirectory->GetKey( sdir.c_str() ) ) {
return false; }
33 gDirectory->cd( sdir.c_str() );
36 gDirectory->cd( full.substr( i ).c_str() );
45 TDirectory* gDir = gDirectory;
48 auto p = full.find(
":", 0 );
49 if ( p != std::string::npos ) {
50 auto fil = full.substr( 0, p );
53 gDirectory->cd( fil.c_str() );
57 while ( ( p = full.find(
"/", i ) ) != std::string::npos ) {
58 lpath.
push_back( full.substr( i, p - i ) );
63 if ( full.compare( 0, 1,
"/" ) == 0 ) gDirectory->cd(
"/" );
65 for (
const auto& lp : lpath ) {
66 if ( !gDirectory->GetKey( lp.c_str() ) ) { gDirectory->mkdir( lp.c_str() ); }
67 gDirectory->cd( lp.c_str() );
88 if ( dir.
compare( 0, 1,
"/" ) != 0 ) { dir.
insert( 0,
"/" ); }
90 if ( dir.
compare( dir.
length() - 1, 1,
"/" ) != 0 ) { dir +=
"/"; }
92 long ll = full.find( dir );
93 if ( ll != 0 ) {
return false; }
95 full.erase( 0, dir.
length() - 1 );