Parse storage root name from sgtk.TemplatePath root_path

I need to know the storage root of a provided filesystem path.

sgtk.TemplatePath is really cool. It gets me as far as the root_path.

Is there a SGTK supported way to get the name of the storage root from the root path? Seems like that would be something really useful for TemplatePath to tell us (it should know right?).

Use case: I’m experimentally patching the old tk-multi-perforce implementation. Our SGTK config uses multiple roots, each mapped to a different Perforce per-user per-workstation workspace name. The config is totally different but quite a bit of it still works if you keep within its design limits.

1 Like

Hi @Rhea_Fischer

I think you could take a given root path and loop over the sgtk.roots, compare the values to find a match. The matching value’s key will be the root name.