Like other Perforce clients, P4EXP takes its configuration parameters from, in order of precedence, the following:
- The configuration file, if any
- Environment settings (the registry)
- System defaults (for example, P4CLIENT defaults to the system's hostname)
As (2) and (3) only allow for setting the variables for a single workspace, the solution lies with using option (1), the configuration file. You can set up a specific configuration file for each workspace that defines how P4EXP (or any Perforce client) acts for that given workspace.
Before you set up the configuration files, you will need to tell the Perforce clients where to look for the configuration file. This is done by setting the P4CONFIG registry setting. Open a command-line window and then issue the following command:
p4 set P4CONFIG=p4config.txt
After this is set, Perforce clients will look for a file named p4config.txt when unsure of what settings to apply.
Now, for each workspace that you want to manage with P4EXP, create a file named p4config.txt in the workspace root. If your workspace root (check with 'p4 client -o <workspace>') is C:\Users\Myname\Project\ProjectAlice, then you would create the p4config.txt file here - C:\Users\Myname\Project\ProjectAlice\p4config.txt
Inside this file, place the following lines of text:
Where <server>, <port>, <username>, and <workspace> are replaced with the parameters specific to your needs.
After this is set, whenever you manipulate a file in that workspace using P4EXP, the right variables are used.
Note: Often times, users wish to prevent p4config.txt from being included in any client operations and from being versioned by Perforce. In a "classic" (non-Streams) environment, this can be accomplished via exclusionary mappings, by adding the following line to your workspace view:
In a Streams environment, you can use the p4 stream command to add p4config.txt to your stream specification's 'Ignored:' field.