Difference between dir and f.root

Hey,

I started doing a backend for my own fs. So far so good. But I don’t get the behavior of dir that's passed to List()and f.root. It seems that if I specify rclone lsl share:/subfolder, then f.root is set to subfolder and dir is ““ (empty string). But if I use for example the HTTP serve feature and start that with share: first and then navigate later to subfolder from the HTTP share, dir will be set to subfolder while f.root remains ““.

Also, I noticed that if dir is set to something, all subsequent entries that I want to render in them need to contain that dir in the remote path.

It’s super confusing. I assume the idea was that f.root is always set to what rclone was started with and dir is the one that’s changing? If so, is there some util that can handle all these edge cases for me so I can always construct a proper path and avoid this directory handling hell?

Thanks