It seems the call is Connection.GetP4EnvironmentVar( "P4PORT" ), but to be able to interrogate a connection I need to connect to a server and hence need a P4PORT in advance, and so have a chicken and egg situation. What is the best practice in this situation? Look in "HKCU\SOFTWARE\perforce\environment" ?
The goal is to run a C# app that can read the P4 env variables to grab P4PORT.
Cheers John
Per the spec fetcher example in the doc, you can create a
ServerAddress
with an empty URI -- this isn't explicitly explained in the doc, but that must be how to have your app get P4PORT from the environment. Assuming that the logic to pullP4PORT
from the environment lives inServerAddress
, you might be able to do something like:If not, then it might need to be a more convoluted incantation along the lines of:
or even: