Jump to content

P4Connect and Windows Environment Variables

p4connect environment bad settings unity 5 windows

  • Please log in to reply
No replies to this topic

#1 Destects



  • Members
  • Pip
  • 3 posts

Posted 25 January 2016 - 04:31 PM

I've always had an issue with P4Connect not wanting to pull it's configuration from the environment variables that perforce supposedly sets.
Clicking "Load P4 Environment" has always yielded the same message "No Perforce Environment variables found!" and up until today I just shrugged it off and manually configured it for whatever my current workspace was.

But I've finally become frustrated enough to investigate why It fails every time, and from everything I've gathered, it seems as if it's got nothing to do with me, and everything to do with bad design in Perforce/P4Connect.

I have the perforce shell extension installed and that picks up the environment configuration just fine, so I knew that SOMETHING was being configured, but for some reason P4Connect never picked up on the configuration. I checked my current environment, and noticed a distinct lack of any perforce variables anywhere (for those that don't know, running "set" in a command prompt on windows will print out the current environment variables.). Just to confirm that I wasn't crazy, I also used processexplorer (from the sysinternals suite) to check p4v, explorer, and unity, all of which lacked any perforce environment variables (such as p4user, p4root, etc).

I googled the message P4Connect outputs, and only got two results, both of which were just the source code for P4Connect. https://swarm.worksh....Config.cs?v=11

Looking at the code, It's clear P4Connect is doing exactly what you'd expect, It's querying the environment variables of the current process and attempting to set its configuration using their values, but if it finds no variables, then it informs you that it couldn't find anything.

It was then an amazing discovery that P4Connect isn't doing anything wrong, in fact, Perforce itself is making the mistake. For whatever asinine reason, specifically on the windows platform, perforce doesn't actually set any environment variables. Explicitly stated here: http://www.perforce....ref/envars.html and http://www.perforce....ref/p4_set.html

"On Windows, you can set the values of these variables in the registry with p4 set; on other operating systems, Perforce uses environment variables for the same purpose."
So basically, Perforce made the design decision that instead of using the same system and design the use on every other platform, they would use the registry on windows, instead of environment variables, but continue to call it the environment configuration. This kind of design choice really gets my blood boiling. Setting an environment variable is just as simple on windows as it is on every other platform.

It's quiet aggravating to find out that the problem has been Perforce's poor design choice and self sabotage this whole time.

But I must also question how this slipped through the cracks for every windows user, how has nobody realized this? Does nobody use the environment configuration? and how is it that P4Connect was ever released without the platform specifics for windows (which are only necessary because of Perforce's failure to follow a seamless design pattern)?

Also tagged with one or more of these keywords: p4connect, environment, bad settings, unity 5, windows

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users