Skip to main content
4-Participant
May 17, 2022
Solved

PTC_D_LICENSE_FILE Definition

  • May 17, 2022
  • 2 replies
  • 4156 views

Can someone explain what the "-" does in the environment variable definition in .psf file (i.e. PTC_D_LICENSE_FILE-=<port>@<License Server Name>)

Best answer by LukaszMazur

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.

2 replies

KenFarley
21-Topaz II
May 17, 2022

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.

4-Participant
May 17, 2022

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.

16-Pearl
May 18, 2022

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.

4-Participant
May 18, 2022

@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.