public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Dipak Gaigole <dipakgaigole@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Problem with chdir and GetCurrentDirectory on Windows 2016
Date: Fri, 09 Dec 2016 07:24:00 -0000	[thread overview]
Message-ID: <CADs2-=TS1x0cLjngCGMxHSEUpy5Wjkv7Xt_H8Sg5OP99nWLgFg@mail.gmail.com> (raw)
In-Reply-To: <CADs2-=R_NxbDNom1MDyyBYgtCfifQ3V-D4jy2wNkHb7fUv0Org@mail.gmail.com>

> >>>>
> >>>> So in this situation, is it possible to get the cwd value as
> >>>> "/cygdrive/c/temp/appdir/bin" using some cygwin API?
> >>>
> >>> No, it is generally not possible to get the POSIX path to anything in
> >>> the cygwin root (/) tree to be prefixed by the /cygdrive prefix. The
> >>> /cygdrive prefix exists solely to resolve paths that are outside of /,
> >>> so paths inside that tree don't need the /cygdrive prefix.
> >>>
> >> This path is also displayed to the enduser at different places. So our
> >> requirement is to always get a path in the /cygdrive/ prefix format
> >> irrespective of whether it is inside the cygwin root (/) or outside of
> >> /.
>
> > I think this can be achieved by getcwd () +
> > cygwin_conv_path(CCP_POSIX_TO_WIN_A,...) and converting the windows
> > style path to /cygdrive/ prefix format.
>
> No, this is wrong approach.
> Do not do manual path manipulation, it WILL fail.
> Always use corrsponding conversion tools provided by Cygwin.

Agreed Andrey. But I couldn't find any API(s) which can serve my
requirements. And we can't afford to execute (fork+exec) tools like
cygpath for each getcwd call.
Any suggestions on improving this approach or any alternative approach
are always welcome.

Thanks,
Dipak

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

  parent reply	other threads:[~2016-12-09  7:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07 20:23 Dipak Gaigole
2016-12-07 20:34 ` Jeffrey Altman
2016-12-07 21:03 ` Dipak Gaigole
2016-12-07 21:08 ` Eric Blake
2016-12-07 22:22   ` Dipak Gaigole
2016-12-07 23:06     ` Eric Blake
2016-12-07 23:52       ` Dipak Gaigole
2016-12-08 12:35         ` Dipak Gaigole
2016-12-08 18:50           ` Andrey Repin
     [not found]             ` <CADs2-=R_NxbDNom1MDyyBYgtCfifQ3V-D4jy2wNkHb7fUv0Org@mail.gmail.com>
2016-12-09  7:24               ` Dipak Gaigole [this message]
2016-12-09  8:42                 ` Csaba Raduly
2016-12-12  9:12                   ` Dipak Gaigole

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='CADs2-=TS1x0cLjngCGMxHSEUpy5Wjkv7Xt_H8Sg5OP99nWLgFg@mail.gmail.com' \
    --to=dipakgaigole@gmail.com \
    --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).