delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/12/01/16:58:53

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4B159192.2050007@bopp.net>
Date: Tue, 01 Dec 2009 15:58:42 -0600
From: Jeremy Bopp <jeremy AT bopp DOT net>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: [1.7] git-difftool paths unusable by win32 kdiff3
References: <db95995b0912011243y3e75f0afqa5fb2d41d7d40540 AT mail DOT gmail DOT com> <4B15868D DOT 7010809 AT bopp DOT net> <db95995b0912011350q4b5f9bbdk1003e926d70a9fdd AT mail DOT gmail DOT com>
In-Reply-To: <db95995b0912011350q4b5f9bbdk1003e926d70a9fdd@mail.gmail.com>
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

David Antliff wrote:
> On Wed, Dec 2, 2009 at 10:11, Jeremy Bopp wrote:
>> David Antliff wrote:
>>> On the other hand, this command does work:
>>>
>>> kdiff3 --auto --L1 "build.xml (A)" --L2 "build.xml (B)"
>>> c:/cygwin-1.7/tmp/Vc0BZy_build.xml build.xml
>> As a fairly simple workaround, you could create a wrapper script which
>> takes the same set of arguments git difftool gives to kdiff3 and
>> converts the given file paths using cygpath -w before exec'ing the real
>> kdiff3.  Then you can point to that wrapper by setting the git
>> configuration variable difftool.kdiff3.path to the path for the wrapper
>> script.  Run "git difftool --help" for more information.
> 
> Jeremy, thank you for your reply.
> 
> It's slightly more complicated than this, because I need a way to
> translate "/tmp" to the Cygwin installation directory. I.e. it's not a
> simple case of replacing "/tmp" with "c:/tmp" but rather
> "$CYGWIN_INSTALL_DIR/tmp" and I'm not sure CYGWIN_INSTALL_DIR or
> anything similar exists.
> 
> This is because my users have cygwin installed in different places.
> For example, some have it on "c:\cygwin", others "d:\cygwin" and even
> "c:\cygwin-1.5" or  "c:\cygwin-1.7". I need a general way to determine
> the Cygwin installation path. Any ideas? Is there a supported way for
> a script to determine the Cygwin installation directory, perhaps
> relative to /cygdrive or as a DOS path?

There is a purpose built tool specifically to handle this which I
mentioned in my reply.  You can use the cygpath program to convert paths
back and forth between Windows-native and POSIX/Cygwin.  Given the file
path in POSIX format as your wrapper would receive it, you can do the
following to convert it to a Windows path:

cygpath -w /tmp/some_file

Assuming your Cygwin installation is in a path such as C:\cygwin, you
will see C:\cygwin\tmp\some_file as output.  This will work no matter
where Cygwin is installed because cygpath can figure it out
automatically.  This is the only supported method of which I'm aware to
convert paths.

Use the --help option for cygpath to see usage instructions for its many
options.

-Jeremy

--
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