Win32 getcwd() and cygdrive

A

Addy

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
 
D

Darren Dunham

Addy said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,187
Latest member
RosaDemko

Latest Threads

Top