This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why are Windows paths broken in make 3.81?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]