public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Thomas Wolff <towo@towo.net>
To: cygwin@cygwin.com
Subject: Re: cygpath -w converts relative paths to absolute windows paths
Date: Sun, 12 Feb 2017 17:39:00 -0000	[thread overview]
Message-ID: <6055a8e1-bfd7-16c7-f25a-e02523863fdd@towo.net> (raw)
In-Reply-To: <20170212112314.GE11666@calimero.vinschen.de>

Am 12.02.2017 um 12:23 schrieb Corinna Vinschen:
> On Feb  7 14:35, Roger Qiu wrote:
>> 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.
>>
>> 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.
> Not easily.  All paths are evaluated as absolute paths inside Cygwin.
> The result of the path conversion is always an absolute path. A relative
> path is generated from there by checking if the path prefix in POSIX
> notation is identical to the current working directory.  If not, the
> path stays absolute.  Naturally, if you use a "..", the resulting path
> does not match the CWD anymore, so you're out.
How about converting getcwd(), too, and comparing that?
------
Thomas

--
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

  reply	other threads:[~2017-02-12 17:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07  3:36 Roger Qiu
2017-02-07 15:35 ` Andrey Repin
2017-02-07 23:13   ` cyg Simple
2017-02-07 23:34   ` Thomas Wolff
2017-02-08  1:00     ` Brian Inglis
2017-02-08 11:06     ` Andrey Repin
2017-02-08 22:42       ` Thomas Wolff
2017-02-11 21:27         ` cyg Simple
2017-02-09  1:17   ` Roger Qiu
2017-02-12 11:23 ` Corinna Vinschen
2017-02-12 17:39   ` Thomas Wolff [this message]
2017-02-13 15:16     ` Corinna Vinschen
2017-02-13 19:34       ` Thomas Wolff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6055a8e1-bfd7-16c7-f25a-e02523863fdd@towo.net \
    --to=towo@towo.net \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).