Skip to content

Commit

Permalink
still return the existing dir if mkdir failed
Browse files Browse the repository at this point in the history
  • Loading branch information
nadrino committed Nov 27, 2024
1 parent 4d16d20 commit c9f2c6c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/GenericToolbox.Root.h
Original file line number Diff line number Diff line change
Expand Up @@ -763,10 +763,11 @@ namespace GenericToolbox {
auto subPath{GenericToolbox::splitString(saveName_, "/", true)};
if( subPath.size() > 1 ){
TDirectory* dir = dir_;
for( auto& subFolder : subPath ){
if( subFolder == subPath.back() ){ continue; } // skip last
dir = dir->mkdir( generateCleanBranchName(subFolder).c_str() );

for( size_t iFolder = 0 ; iFolder < subPath.size()-1 ; iFolder++ ){
dir = GenericToolbox::mkdirTFile(dir, generateCleanBranchName(subPath[iFolder]));
}

saveName_ = subPath.back(); // only keep the last bit for the object name
dir_ = dir; // new dir is the sub-dir
}
Expand Down

0 comments on commit c9f2c6c

Please sign in to comment.