delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/12/09/02:24:46

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:from:date
:message-id:subject:to:content-type; q=dns; s=default; b=ySFf8xT
6jxM79xMvuCyBNWjCcWfpdl97BwZh9Od/mOJDmCs3HIuLWhmCLu8fu6h5VQHXCDy
z16PmAq7TNV294WU+StDo/RqAH69Ys68etkmZQfA5ISMoM7PxTwly33wMVTEQXQf
lMW1KJBqZlzqbfifTLJ0+idOfjKy9gVErW9I=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:from:date
:message-id:subject:to:content-type; s=default; bh=Am6NpPyKZwNk6
BrEaM3v4nEQw9U=; b=sWZocM3g8gV+X6jmEG2cxL6zDiEclHlz0CYZy8RRcdmms
SSRj36a5Rr/sdq8e22IXFt+umAE3Y3xoW5YwxIgqqH53sOvNSIkhfTtmGbU4T+WA
MW8VH/0KKgNkrptM58i8HpBWSa9M0nBAWGiq5fXYUxlPmps4wWL0xFk7+sbpLA=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=improving, H*f:sk:8871168, WILL, our
X-HELO: mail-qk0-f180.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=YJhgbJ4wGG7yKjLZQcjIsups3NfIk3SXQJvOlO0vhb4=; b=eMGi/rNfRbBgBvkTxfXFviaMXJtky0pef7C7C0buQw+yUL/2Dd5iHxBea/HbpLTy7e BDQ/rH2TL0gNLyAqvEl1dbRH4YAJzrbx5hxRej8aJ91bqK7/JFjlvVbRHDl+EEjcqX6+ knd+nWOqAryJ4y3diBz8JExHJd/bha9N9T1yif89wXVhJ2lzxpZfNYHEmos3GCWp+OUo GCuZQUWC5UbD+Q5RkJF27Dcg47knURDvev7CNlTeT9b6708Du8MrZ7iK+KR4FpCbm0qk lfkQ7dF41RymJn9i6lwkFpE2X6y+tiHc5DAwmrtGNeHc+GJw/3cvU4hbxUsFwdnJvQvT 4Pnw==
X-Gm-Message-State: AKaTC02P57P47YjR1H1A5Er6ypuIdEN0nUuT0O/EzjiFAlnE52i26cSi0cKxvjYfFt4BuW0KlWXP5JK/gcWVxw==
X-Received: by 10.55.201.8 with SMTP id q8mr67191280qki.42.1481268247636; Thu, 08 Dec 2016 23:24:07 -0800 (PST)
MIME-Version: 1.0
In-Reply-To: <CADs2-=R_NxbDNom1MDyyBYgtCfifQ3V-D4jy2wNkHb7fUv0Org@mail.gmail.com>
References: <CADs2-=TCsi-vpQxa+Nhwgc6GHo734qpGh+DOYcuYo36C5r4t0g AT mail DOT gmail DOT com> <a26c3edd-8221-12e3-9bc5-c03c7b13bca1 AT redhat DOT com> <CADs2-=QW6AeU9a8_7c557WBfB2VgY6aNQ19E+YK-fd_jnKBMfw AT mail DOT gmail DOT com> <6e5968a1-a667-f911-fbec-f83e4ef34608 AT redhat DOT com> <CADs2-=TeVMnQ5sdVGJnSw0ouNh_dj3cBf1PP6fN-62smsBeDpA AT mail DOT gmail DOT com> <CADs2-=Sh5cR-LTmxTsVR=jkcGJ0AxhU=ssg436CCJ5DT9WSnSA AT mail DOT gmail DOT com> <887116862 DOT 20161208214534 AT yandex DOT ru> <CADs2-=R_NxbDNom1MDyyBYgtCfifQ3V-D4jy2wNkHb7fUv0Org AT mail DOT gmail DOT com>
From: Dipak Gaigole <dipakgaigole AT gmail DOT com>
Date: Fri, 9 Dec 2016 12:54:07 +0530
Message-ID: <CADs2-=TS1x0cLjngCGMxHSEUpy5Wjkv7Xt_H8Sg5OP99nWLgFg@mail.gmail.com>
Subject: Re: Problem with chdir and GetCurrentDirectory on Windows 2016
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019