Mutterings

Perforce and Cygwin

May 31st, 2007 · 3 Comments

I love Perforce as an SCM system - it’s not as dead simple as SVN but it’s pretty simple to use once you understand what a clientspec is (in fact I wrote the Perforce SCM plugin for Maven 2.x).

I like cygwin - the installer is horrible but it works ok once you get past that.

The problem is that the two don’t work too well together. cygwin likes to use pseudo-unix paths on Windows that look like /cygdrive/c/src/foo/bar instead of c:\src\foo\bar. So when you create a bash script to automate some file chore, those paths are used. Well, Perforce doesn’t understand those paths. Others have suggested creating a clientspec whose root matches the cygwin syntax and use that clientspec with the cygwin tools. My solution is simpler but non-obvious: use the cygpath command to convert the cygwin path to a standard windows path but it must be an absolute path. If it is not an absolute path, p4 tries to resolve the path and cygwin will hand it a cygdrive-style path again.

}