chase2110 Posted August 26, 2020 Share Posted August 26, 2020 (edited) I want to create a variable called $CACHE that copies the $HIP path but replaces the drive letter from C: to X:. I know I can set variables in the environment file but I'm not sure how to do it for this or even if that's the right way. Any help would be appreciated. Edited August 28, 2020 by chase2110 solved Quote Link to comment Share on other sites More sharing options...
chase2110 Posted August 28, 2020 Author Share Posted August 28, 2020 I figured it out. Just posting in case anyone else is trying to do something like this. I created a file called 456.py and placed it in in my $HOUDINI_USER_PREF_DIR in a folder called scripts. This file gets run every time houdini opens a .hip file. Inside the file I used this as my code: import re CACHE = str(hou.expandString('$HIP')) CACHE = re.sub('\AC:|D:', 'X:', CACHE, 1) hou.hscript('setenv -s CACHE=%s'%(CACHE)) It copies the hip path Searches the beginning for C: or D: and replaces it with X: Then sets the environment variable. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.