Environment Variables as storage roots

So I have put some environment variables as the storage location in file management. My method did require me to change files in C:\Program Files\Shotgun\Python\Lib\os.py. This obviously isn’t ideal. Is there a preferred way to put environment variables as storage? Or a preferred way to override that python file?

3 Likes

Are the env vars consistent across all users?

1 Like

They would be, yes.

1 Like

Unfortunately we don’t provide a way at the moment to use an environment variable in a storage root.

However if you were to modify our code to do it, I would have thought the changes should be made to tk-core and maybe the tk-framework-desktopserver and not to the os module.

I’ve logged a request on our roadmap page on your behalf.

1 Like

Yup, we had to do this for a client to have per-user roots (perforce setup).
If the env var changes, you’ll have to use a “dummy” path for any paths stored as filesystem locations and then in the files Phil mentions, translate that path to/from the env var path when reading or writing to the database. It seems to work ok amazingly!.. but no doubt there are some failure cases that I’ve not discovered yet.
One other area you will have to update are all the workfiles, and loader2 hooks that might not expand the env vars in paths.

2 Likes