This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Problem with chdir and GetCurrentDirectory on Windows 2016
- From: Andrey Repin <anrdaemon at yandex dot ru>
- To: Dipak Gaigole <dipakgaigole at gmail dot com>, cygwin at cygwin dot com
- Date: Thu, 8 Dec 2016 21:45:34 +0300
- Subject: Re: Problem with chdir and GetCurrentDirectory on Windows 2016
- Authentication-results: sourceware.org; auth=none
- Authentication-results: smtp3o.mail.yandex.net; dkim=pass header.i=@yandex.ru
- References: <CADs2-=TCsi-vpQxa+Nhwgc6GHo734qpGh+DOYcuYo36C5r4t0g@mail.gmail.com> <a26c3edd-8221-12e3-9bc5-c03c7b13bca1@redhat.com> <CADs2-=QW6AeU9a8_7c557WBfB2VgY6aNQ19E+YK-fd_jnKBMfw@mail.gmail.com> <6e5968a1-a667-f911-fbec-f83e4ef34608@redhat.com> <CADs2-=TeVMnQ5sdVGJnSw0ouNh_dj3cBf1PP6fN-62smsBeDpA@mail.gmail.com> <CADs2-=Sh5cR-LTmxTsVR=jkcGJ0AxhU=ssg436CCJ5DT9WSnSA@mail.gmail.com>
- Reply-to: cygwin at cygwin dot com
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