delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/09/25/19:52:20

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <46F99F19.A8F785F@dessent.net>
Date: Tue, 25 Sep 2007 16:51:53 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygpath -u doesn't seem to convert spaces properly
References: <fdc59a$ng5$1 AT sea DOT gmane DOT org>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
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

Jerome Fong wrote:

> I am trying to use cygpath -u to convert my windows path to an unix path
> in my shell script.  However, it has problems with paths that has spaces
> in it.  For example, "cygpath -u c:\Program Files\Java" is converted to
> /cygdrive/c/Program Files/Java, which doesn't work.  Is there a flag
> that I am missing?

The unix version is correct but still has spaces, which means it still
needs proper quoting.  So if you are doing something like this:

ls $(cygpath -u 'c:\Program Files\Java')

then you are not quoting sufficiently.  However, in your example below
you appear to be using the proper amount of quoting:

> $ cygpath -u "$(cygpath -m -s "c:\Program Files\Java")"
> /cygdrive/c/PROGRA~1/Java

So please give us an example of exactly the command that fails, because
there should never be a need to resort to using the 8.3 short filename
ugliness -- especially since this is an optional NTFS feature that can
be disabled in order to speed things up, which means it's not entirely
portable (not to mention wholly unnecessary as long as proper quoting is
used.)

Brian

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

- Raw text -


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