delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/12/08/13:50:44

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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=qZojBG4QzuYPazZ7
v9+ZgzUeRvMUuxSDR8J1pFD5T28NkUXvFC4Wzm1rn23BghHsiuSwrWcnm6E07Mhy
O/ONoooogKJrGEjM/hnWUV+6W1rlVyUv3jeckL9gVxLTKXMnHGvtKGss/RB+oYG2
1UKhisXpCGZ8uUfzHI9hevbF+uY=
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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=aRxewYIczXR1GDsw/XhYQi
ywfAE=; b=fQG4ID8kB3GAAFILYYoS3U7orsUtXGQ+mAUJO0tNRIFIRfuV0YXR7O
PwfPE3XkEBq0t9PTdk4PqMQNk5og28MEKj7IuzFXoV+APZF7i0iuBt3p3dk2KHEq
eXnF1O6dVJYeNqB0xXZ7MKQX/t8w6CUEhSL0stSMawV1YZHogTvEY=
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.0 required=5.0 tests=BAYES_50,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=H*F:D*yandex.ru, Andrey, andrey, Hx-languages-length:1143
X-HELO: forward5m.cmail.yandex.net
Authentication-Results: smtp3o.mail.yandex.net; dkim=pass header.i=@yandex.ru
X-Yandex-Suid-Status: 1 0,1 0
Date: Thu, 8 Dec 2016 21:45:34 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <887116862.20161208214534@yandex.ru>
To: Dipak Gaigole <dipakgaigole AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: Problem with chdir and GetCurrentDirectory on Windows 2016
In-Reply-To: <CADs2-=Sh5cR-LTmxTsVR=jkcGJ0AxhU=ssg436CCJ5DT9WSnSA@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>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Dipak Gaigole!

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


-- 
With best regards,
Andrey Repin
Thursday, December 8, 2016 21:44:42

Sorry for my terrible english...


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