This is the mail archive of the
mailing list for the Cygwin project.
Re: 1.7] Can you have multipe cygdrive path prefixes active at once
> Jeremy Bopp wrote:
>> aputerguy wrote:
>>> In particular, I can't use "mount -p" to distinguish between prefixes
>>> might have (variable) number of trailing spaces (which is allowed).
>> I believe that you want to use the cygpath program if you want to
>> convert POSIX paths to Windows paths reliably. Assuming the default
>> cygdrive prefix is in use:
>> $ cygpath -w /cygdrive/c/an/example/posix/path
> All true and known. BUT I want to know the cygdrive prefix in general for
> use in future constructions rather than just making a single path. Say if I
> want to find all files, I want to do something like "find <cygdrive-prefix>
Well, it's a bit of a hack, but you could try something like the following:
$ dirname $(cygpath -u C:/)
This assumes that there is always a C: drive and converts the path to
the root of that drive into a POSIX path which will include the cygdrive
prefix. Then dirname is used to effectively chop off the drive letter
leaving you with the cygdrive prefix.
If you're thinking that you can run something like ls or find the
cygdrive prefix and enumerate all of the drives on the system, you
should know that it won't work in some cases, such as when someone sets
their cygdrive prefix to "/". In this case, the drives are still
available explicitly as /c, /d, etc. but they will not be enumerated by
"ls /" or "find /".
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple