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: cygpath -w converts relative paths to absolute windows paths


Hi Andrey,

That was probably true in the past, but no longer!

I just tested this: `mklink /D testlink "..\All Users"` in cmd and then I went to Cygwin ZSH, and ran `ll`.

This showed me: `testlink -> '../All Users'/`.

Up one directory relative links do work on Windows! This is a directory symbolic link, which is superior to directory junctions.

Regardless of directory junction support (which I didn't test), I think `cygpath` should give the right results, when I don't specify an absolute path, I really mean give me the windows version of the relative path.

Now maybe there's some backwards compatibility issues, then perhaps a flag that can be set to mean `--really-relative`.

Thanks,

Roger

On 8/02/2017 2:30 AM, Andrey Repin wrote:
Greetings, Roger Qiu!

Hi,
I've found that `cygpath --windows '../` will give back an absolute
windows path.
I thought this would only happen if you provide the `--absolute` flag,
or when the path is a special cygwin path.
".." is a special path, that can't be safely converted.
In all cases, using absolute path is preferred for many reasons.

But this occurs just for normal directories.
I have come across a situation where I need to convert ntfs symlinks to
unix symlinks and back. Sometimes these symlinks have relative paths
them. Now by using cygpath --windows, I get back absolute paths, which
means the integrity of the symlink isn't preserved.
Can `cygpath --windows '../directory'` give back `..\directory` for
paths aren't special cygwin paths? These relative backslashes are
supported in Windows right now.
AFAIK, Windows do not support relative junction points.



--
Founder of Polycademy
http://polycademy.com/
+61420925975


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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