delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/10/01/04:24:38

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Lenik <lenik AT bodz DOT net>
Subject: cygpath output unnecessary ending slash/
Date: Thu, 01 Oct 2009 16:23:57 +0800
Lines: 39
Message-ID: <ha1ov1$53v$1@ger.gmane.org>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019