This is the mail archive of the
mailing list for the Cygwin project.
Re: get cygpath to leave relative paths as relative?
- From: Brent <yhbrent at yahoo dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 11 Dec 2007 21:25:34 -0800 (PST)
- Subject: Re: get cygpath to leave relative paths as relative?
>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.
>... 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: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html