Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Can someone explain what the "-" does in the environment variable definition in .psf file (i.e. PTC_D_LICENSE_FILE-=<port>@<License Server Name>)
Solved! Go to Solution.
Out of curiosity I've tested it (as I have never before paid that much attention to it) and it doesn't seem like a superfluous character like @KenFarley suspected. From what I saw it looks like this:
1. ENV=VARIABLE_NAME=VALUE
will set the variable VARIABLE_NAME with only a VALUE defined in psf file, e.g. ENV=PTC_D_LICENSE_FILE=7788@license_server will get you variable PTC_D_LICENSE_FILE=7788@license_server regardless of its previous value.
2. ENV=VARIABLE_NAME+=VALUE
will append the value at the end of the VARIABLE_NAME existing values list. e.g. ENV=PTC_D_LICENSE_FILE+=7788@localhost, will get you PTC_D_LICENSE_FILE=7788@license_server;7788@localhost (appending to the previously defined variable value of 7788@license_server)
3. ENV=VARIABLE_NAME-=VALUE
will place the new value in the beginning of values list for that variable, e.g. ENV=PTC_D_LICENSE_FILE-=7788@localhost will get you PTC_D_LICENSE_FILE=7788@localhost;7788@license_server (so when Creo starts your local license server will take precedence when searching for Creo licenses and when it's not available Creo will fall back to the next server in line).
Hope it makes sense. You can see that PATH variables are defined in similar way, using "+" and "-" to not overwrite existing PATH values but to append the new values at correct places.
It's just a character. Probably in the past someone *meant* to just have the variable be PTC_D_LICENSE_FILE, but made a typo and added a superfluous "-" and now the world at large is stuck with it? It's not particularly readable, but perfectly legal in the context of an environment variable name.
Thank you Ken for the feedback.
I thought there was a function of this character in the past, but I'm glad to hear there is no relevance to this character.
Out of curiosity I've tested it (as I have never before paid that much attention to it) and it doesn't seem like a superfluous character like @KenFarley suspected. From what I saw it looks like this:
1. ENV=VARIABLE_NAME=VALUE
will set the variable VARIABLE_NAME with only a VALUE defined in psf file, e.g. ENV=PTC_D_LICENSE_FILE=7788@license_server will get you variable PTC_D_LICENSE_FILE=7788@license_server regardless of its previous value.
2. ENV=VARIABLE_NAME+=VALUE
will append the value at the end of the VARIABLE_NAME existing values list. e.g. ENV=PTC_D_LICENSE_FILE+=7788@localhost, will get you PTC_D_LICENSE_FILE=7788@license_server;7788@localhost (appending to the previously defined variable value of 7788@license_server)
3. ENV=VARIABLE_NAME-=VALUE
will place the new value in the beginning of values list for that variable, e.g. ENV=PTC_D_LICENSE_FILE-=7788@localhost will get you PTC_D_LICENSE_FILE=7788@localhost;7788@license_server (so when Creo starts your local license server will take precedence when searching for Creo licenses and when it's not available Creo will fall back to the next server in line).
Hope it makes sense. You can see that PATH variables are defined in similar way, using "+" and "-" to not overwrite existing PATH values but to append the new values at correct places.
@LukaszMazur Thank you for investing this. I thought I remembered something about the '-' but I was not aware of the '+'
Thank you for looking into this and sharing your findings.
Wow, that is really weird and pretty cool. It's like C code in the initialization file. Live and learn.