Cygwin uses a different path scheme than Windows. If you use a Cygwin shell with Cygwin programs, then everything works well. But if you use a Cygwin shell as your default shell (which I do, because face it, cmd.exe sucks) and you’re running non-Cygwin programs, you can run into trouble because the shell may send Cygwin-style paths for filenames to Windows programs that don’t understand them.
For instance today I was using a Cygwin bash shell with a non-Cygwin Perforce client (i.e.: “p4”).
$ p4 open foo.cpp Path '/cygdrive/c/dev/project/...\foo.cpp' is not under client's root 'C:\dev\project'.
p4 is a regular (non-Cygwin) program and thus it doesn’t understand the Cygwin path that gets sent to it.
One way to fix this would be to find a version of p4 that was compiled against Cygwin.
Another way is to use the
cygpath command to convert the Cygwin path to a Windows path.
$ p4 open $(cygpath -aw foo.cpp) //depot/project/foo.cpp#2 - currently opened for edit
-a option tells it to generate an absolute path and the
-w option tells it to convert from a Cygwin path to a Windows path.