System variable check for package .json files

   993   2   0
User Avatar
Member
53 posts
Joined: Feb. 2017
Offline
Hi there,

I have an HDA that I am trying to configure as a Houdini package so I can include executables for OpenImageIO and OpenColorIO with it. However, users might already have OCIO configured as their system variable. I can ofcourse set OCIO in the packages .json configuration, but I would like to skip that option is $OCIO is already configured by the user. How do I check in the package .json if a system variable already exists? As far as I understand the 'recommends' and 'required' keywords do not handle this case.

Cheers!
Technical VFX artist @ Housemarque / Sony Interactive Entertainment
User Avatar
Staff
411 posts
Joined: Feb. 2018
Offline
You could try using the default variable syntax: ${VAR-DEFAULT}

If VAR is already set, it expands to its current value. If not, VAR expands to the DEFAULT value.

https://www.sidefx.com/docs/houdini19.0/ref/plugins.html#def_var_syntax [www.sidefx.com]
User Avatar
Member
1 posts
Joined: Nov. 2015
Online
mabelzile
You could try using the default variable syntax: ${VAR-DEFAULT}

If VAR is already set, it expands to its current value. If not, VAR expands to the DEFAULT value.

https://www.sidefx.com/docs/houdini19.0/ref/plugins.html#def_var_syntax [www.sidefx.com]

Great, I'll give that a try. I must have read over this, but didn't really get the current explanation. It would be nice if the example included a variable that is already set so that is shows a case where it does not take the 'DEFAULT' side of the equation. Thanks for the fast help though!
  • Quick Links