cygpath output unnecessary ending slash/

Lenik lenik@bodz.net
Thu Oct 1 08:24:00 GMT 2009


When specify --windows or --mixed form, cygpath will append `/' to the 
result path when it is a directory, this is unnecessary and 
inconformity, for example:

cygpath -u some/dir
     > some/dir
cygpath -m some/dir
     > some/dir/
cygpath -w .
     > x:\some\dir\

The ending `\' is only needed when the win32 path points to the drive 
root, for example /cygdrive/c => C:\, and even this is not a must, 
because in most cases the path will join another path segment `cygpath 
-w /cygdrive/c`/path/segment and the slash after the drive letter is 
duplicated.

A severe problem with the ending back-slash \ is it will cause to escape 
the following quote (", ') character,

     if [ "$cygwin" = "true" ] ; then
       PROJECT_HOME=`cygpath -w "$PWD"`
     else
       PROJECT_HOME=`pwd`
     fi

     # do with "$PROJECT_HOME" ...

The PROJECT_HOME looks like "T:\TEMP\" and it cause the following 
statement can't be parsed correctly:
     # do with "T:\TEMP\" ...
the \" is escaped, then

apache-forrest-0.8/main/forrest.build.xml
/mnt/t/apache-forrest-0.8/tools/ant/bin/ant: eval: line 301: unexpected 
EOF while looking for matching `"'
/mnt/t/apache-forrest-0.8/tools/ant/bin/ant: eval: line 302: syntax 
error: unexpected end of file



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list