Win32 getcwd() and cygdrive

Discussion in 'Perl Misc' started by Addy, Aug 3, 2005.

  1. Addy

    Addy Guest

    Hello,

    I'm using getcwd() in a script that works fine when I run it locally
    but not so when it's ran on a remote machine.

    Basically, getcwd() returns to me the normal Windows style path
    (c:/foo/foo1), whereas when the same exact script is ran on this remote
    machine the path is formatted like: /cygdrive/c/foo/foo1

    Also, I'm running into a problem where I have to doubly escape slashses
    to get something to work on the remote machine, wheras I don't have to
    do that locally.

    I'm trying to determine what the exact difference is in the two
    machines' configuration of Perl. I think the remote machine is using
    the Perl that comes with Cygwin whereas my install is from ActiveState.
    I thought they would be the same, but I really don't know.

    Can someone shed some light onto this for me?

    Any help is much appreciated.

    Thank you,
    Adalid
     
    Addy, Aug 3, 2005
    #1
    1. Advertising

  2. Addy <> wrote:
    > Hello,


    > I'm using getcwd() in a script that works fine when I run it locally
    > but not so when it's ran on a remote machine.


    > Basically, getcwd() returns to me the normal Windows style path
    > (c:/foo/foo1), whereas when the same exact script is ran on this remote
    > machine the path is formatted like: /cygdrive/c/foo/foo1


    Probably depends on which perl you have. Cygwin binaries are going to
    give you the Unix style path, while a native binary like activestate
    will give you the native windows path.

    In my cygwin shell....

    $ cd /cygdrive/c
    $ /cygdrive/c/Perl/bin/perl -le 'use Cwd; print getcwd'
    c:/
    $ /usr/bin/perl -le 'use Cwd; print getcwd'
    /cygdrive/c

    > I'm trying to determine what the exact difference is in the two
    > machines' configuration of Perl. I think the remote machine is using
    > the Perl that comes with Cygwin whereas my install is from ActiveState.
    > I thought they would be the same, but I really don't know.


    The 'perl' part is probably very similar, but the answers that perl gets
    to things like getcwd() may change.

    --
    Darren Dunham
    Senior Technical Consultant TAOS http://www.taos.com/
    Got some Dr Pepper? San Francisco, CA bay area
    < This line left intentionally blank to confuse you. >
     
    Darren Dunham, Aug 3, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Erik  Bethke
    Replies:
    7
    Views:
    387
    =?ISO-8859-1?Q?Walter_D=F6rwald?=
    Feb 9, 2005
  2. Jona
    Replies:
    1
    Views:
    658
    Jack Klein
    May 24, 2007
  3. r0g
    Replies:
    3
    Views:
    430
  4. Replies:
    2
    Views:
    511
  5. iMath
    Replies:
    4
    Views:
    238
    iMath
    Sep 27, 2012
Loading...

Share This Page