#ifndef C1A4FAE3_95D5_446C_9D8B_3040BB335215
#define C1A4FAE3_95D5_446C_9D8B_3040BB335215

#include <TDirectory.h>
#include <mesytec-mnode/mnode_string.hpp>

namespace mesytec::mnode::mana
{

template <typename It> TDirectory *root_mkpath_cd(It begin, It end)
{
    TDirectory *result = nullptr;
    for (auto it = begin; it != end; ++it)
    {
        result = gDirectory->mkdir(it->c_str(), "", true);
        result->cd();
    }

    return result;
}

template <typename C> TDirectory *root_mkpath_cd(const C &components)
{
    return root_mkpath_cd(components.begin(), components.end());
}

} // namespace mesytec::mnode::mana

#endif /* C1A4FAE3_95D5_446C_9D8B_3040BB335215 */
