X-Spam-Check-By: sourceware.org
Date: Wed, 26 Jul 2006 12:51:05 -0400
From: Christopher Faylor <cgf-no-personal-reply-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Why are Windows paths broken in make 3.81?
Message-ID: <20060726165105.GA25656@trixie.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <9c2aabaf0607211629u4e29ffa1w5f09b3d8e5a923fc@mail.gmail.com> <e9rrqr$6ei$1@sea.gmane.org> <9c2aabaf0607260912n4d17a340j533a049565234c00@mail.gmail.com> <20060726162609.GA24491@trixie.casa.cgf.cx>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060726162609.GA24491@trixie.casa.cgf.cx>
User-Agent: Mutt/1.5.11
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Wed, Jul 26, 2006 at 12:26:09PM -0400, Christopher Faylor wrote:
>Maybe someone here would be willing to post a sed transformation which
>would change c:\some\dos\path to /cygdrive/c/some/dos/path.

Here are two simple, imperfect proof-of-concept perl scripts.

The first one just translates everything to /cygdrive/X/foo.  The second
one uses cygpath to get mount-table-aware paths.

And, to reiterate: I know that these aren't perfect and miss some cases
(like when part of a filename is located in a variable).  I merely offer
them as is as an example of what could be done.

cgf

#!/usr/bin/perl
while (<>) {
    s!\b([a-z]):((?:[/\\][^/\\\s]+)+)!"/cygdrive/$1" . &fixslash($2)!eg;
    print;
}

sub fixslash {
    my $x = shift;
    $x =~ s%\\%/%g;
    return $x;
}

#!/usr/bin/perl
while (<>) {
    s!\b([a-z]:(?:[/\\][^/\\\s]+)+)!&fix($1)!eg;
    print;
}

sub fix {
    my $x = `cygpath -u '$_[0]'`;
    chomp $x;
    return $x;
}

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

