Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know can I change from cygwin paths to normal windows drive? CYGWIN PATH:-/cygdrive/e/8660_qnx/1014/HY/data/install NORMAL PATH:-E:/8660_qnx/1014/HY/data/install

Replies are listed 'Best First'.
Re: Generic questionwith cygwin path
by roboticus (Chancellor) on Mar 22, 2011 at 19:59 UTC

    Check the cygpath command. It'll help you translate between the cygwin and Win/DOS paths.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Is there a env variable which I can set on the cmd window so that all the paths are WIN paths?

        The point of cygwin is to be able to compile and run applications designed for unix with minimal change. Unix applications aren't designed to handle absolute paths to start with something other than "/" and they don't have a concept of a work directory per drive. Nearly every application would have to be changed to support this switch you describe, so I doubt its existence.
Re: Generic questionwith cygwin path
by Anonymous Monk on Mar 23, 2011 at 07:53 UTC
      Something like
      #!/usr/bin/perl -- use strict; use warnings; Main( @ARGV ); exit( 0 ); sub Main { print Plath( join ':', '.', '/usr/local/bin', '/mingw/bin', '/bin', '/c/WINDOWS/system32', '/c/WINDOWS', '/local/bin', '/mingw/bin', ),"\n"; print Plath( '.:/bin:/cygdrive/e/8660_qnx/1014/HY/data/install' ), +"\n"; } BEGIN { my $CygwinPaths = eval { require Filesys::CygwinPaths; 1; }; my $Stat = qx!stat.exe -c %n /!; sub Plath { my( $path ) = @_; my @path; for my $p ( split ':', $path ) { if( $CygwinPaths ){ push @path, Filesys::CygwinPaths::fullwin32path($p); } elsif( $Stat) { push @path, qx!stat -c %n $p!; } else { push @path, $p if $p =~ s!^/([a-z]{1,2})/!$1:/!; push @path, $p if $p =~ s!^/cygdrive/([a-z]{1,2})/!$1: +/!; } } return join ';', @path; } } __END__