cygpath doesn't convert Windows path correctly

ATN picture ATN · Apr 14, 2013 · Viewed 7.3k times · Source

command line shell

echo %PIG_HOME%
C:\cygwin\usr\lib\pig

cygwin

echo $PIG_HOME
C:\cygwin\usr\lib\pig

echo $( cygpath -u "$PIG_HOME" )
/usr/lib/pig

cd $( cygpath -u "$PIG_HOME" )
-bash: cd: /usr/lib/pig: No such file or directory

Question: why is cygpath not converting it to /cygdrive/c/cygwin/usr/lib/pig?

UPDATE:

The path to the pig folder is correct.

command line shell

C:\Users\john.doe> cd %PIG_HOME%
C:\cygwin\usr\lib\pig>

cygwin

john.doe@COMPUTER ~
$ cd /cygdrive/c/cygwin/usr/lib/pig/

john.doe@COMPUTER /cygdrive/c/cygwin/usr/lib/pig
$

Answer

Zombo picture Zombo · Apr 14, 2013

With Cygwin,

C:\cygwin\lib\pig = /usr/lib/pig

and

C:\cygwin\usr\lib\pig = /cygdrive/c/cygwin/usr/lib/pig

This setup is by design.

The C:\cygwin\usr\lib folder is not created by any packages and should not be created by you either.