This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: get cygpath to leave relative paths as relative?

Corinna wrote:

>This is not always possible when converting POSIX paths to Win32 paths
>for a couple of reasons.  One reason is that a relative path might
>contain symlinks, another one is that a path containing .. could cross
>mount points.  To recognize both cases extra processing is necessary
>which might convert the path to an absolute form.

Thanks for responding.

You use qualifiers like "not always possible" and "might".  Does that imply that cygpath CAN leave relative paths as relative under certain circumstances?

What I am seeing is that it always converts relative paths to absolute paths, even in cases that are outside the scenarios that you mention.  In particular, I have no symlinks.  But I am not sure what you mean by "cross mount points.  Sorry for my ignorance, but are you saying that if my path list contains paths that come from different physical drives ("mount points"?), then this will cause cygpath to always revert to absolute form?  If that is the meaning, then my path list does "cross mount points" because I have multiple physical drives.

On the other hand, I wrote a simple test script that basically just contains the line
    echo `cygpath -pw ../:../..`
I executed that script from a cygwin bash shell located several directories deep within one physical drive, so that the ..'s are guaranteed to stay within the same drive (i.e. so the path list above should never "cross mount points").  But cygpath still spits out absolute paths even in this case.

So, it is as if cypath always has the -a option on even if you do not specify it.

Igor wrote:

>... if you don't have any symlinks in the relative path,
> you should be able to use the forward slash variant without
>using cygpath.  All Windows system calls (and most Windows programs)
>understand forward slashes just fine.

Thanks for pointing out that most Windows system calls understand /'s just fine too--I had observed that with java before, but did not realize that it was so universal.

But the absence of symlinks will not help me avoid a call to cygpath because my path list by default uses unix style : chars as path separators, but if the script is running on windows (e.g. via cygwin), then the program that will use that path list (java in my case) needs windows style ; path separators.  (My script is intelligent enough to autodetect if is being run on cygwin, and it takes certain custom actions such as this in this case, because I want the script to run on any unix.)

Never miss a thing.  Make Yahoo your home page.

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]