Reputation: 5454
In cygwin, in order to remove /cygdrive
prefix in the paths, I did a mount like this -
mount -c /
after restarting cygwin, when I say pwd
- it gives me something like - /c/Work/shared/imply-1.1.1
[actually per windows c:\Work\shared\imply-1.1.1
]
and now I have a perl script that I am running using cygwin and I see an error ... something like - Error: Cannot find module 'C:\c\Work\shared\imply-1.1.1\dist\pivot\bin\pivot'
that additional /c/
which is a drive notion returned from cygwin is causing above error (at least one way of looking at it).
Any idea on how to get rid of that ?
Update: To give a better context to the above issue. Here is what is happening - There is a script file, whose contents are as follows -
#!/bin/bash -eu
if [ "$#" -gt 1 ]
then
echo "usage: $0 [conf-dir]" >&2
exit 1
fi
PWD="$(pwd)"
WHEREAMI="$(dirname "$0")"
if [ "$#" -lt 1 ] || [ "x$1" = "x" ]
then
CONFDIR="$WHEREAMI"/../conf
else
CONFDIR="$1"
fi
CONFDIR="$(cd "$CONFDIR" && pwd)/pivot"
WHEREAMI="$(cd "$WHEREAMI" && pwd)"
When I echo the contents of the CONFDIR and WHEREAMI, I get the following -
C:\cygdrive\c\Work\shared\imply-1.1.1\conf\pivot
C:\cygdrive\c\Work\shared\imply-1.1.1\bin\
But the ${pwd} paths were supposed to be resolved as "c:\Work....."
So what I am doing wrong in cygwin?
Upvotes: 0
Views: 2026
Reputation: 11
What about cygpath (Convert Unix and Windows format paths, or output system path information)...
$ pwd
/cygdrive/c/Windows/System32
$ cygpath -w $(pwd)
C:\Windows\System32
Upvotes: 0
Reputation: 118128
Don't mount C:\
as /
in Cygwin:
If this is any help for you, I was intent to use something similar to what you want ... I've tried, first on NT4, then on W2k, to setup a *NIX-like single-root filesystem, where
C:\
is the only root, and every other device is a [sub]folder somewhere out there.Guess, what? It didn't work ... You can't reliably use CD/DVD drives, when they are not represented as disk letters, you can't disconnect removable drives without first breaking the mount point ... it's just too much trouble to maintain.
Also, I have been mixing Cygwin, Strawberry, and custom MSVC builds of perl
on the same machine for more than a decade now, and I do not understand how the /cygdrive
prefix presents a problem.
In Cygwin Bash, the following works as expected:
$ ls D:/Src
In cmd.exe
,
C:\Users> c:\opt\cygwin64\bin\perl -E "opendir $h, 'D:/Src'; say for readdir $h"
also works as expected.
See also the CYGWIN environment variable:
(no)dosfilewarning
- If set, Cygwin will warn the first time a user uses an "MS-DOS" style path name rather than a POSIX-style path name. Defaults to off.
Upvotes: 0