From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57293 invoked by alias); 9 Dec 2016 07:24:27 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 57240 invoked by uid 89); 9 Dec 2016 07:24:20 -0000 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 Received: from mail-qk0-f180.google.com (HELO mail-qk0-f180.google.com) (209.85.220.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 07:24:19 +0000 Received: by mail-qk0-f180.google.com with SMTP id q130so9561153qke.1 for ; Thu, 08 Dec 2016 23:24:09 -0800 (PST) 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 Received: by 10.140.25.171 with HTTP; Thu, 8 Dec 2016 23:24:07 -0800 (PST) In-Reply-To: References: <6e5968a1-a667-f911-fbec-f83e4ef34608@redhat.com> <887116862.20161208214534@yandex.ru> From: Dipak Gaigole Date: Fri, 09 Dec 2016 07:24:00 -0000 Message-ID: Subject: Re: Problem with chdir and GetCurrentDirectory on Windows 2016 To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00096.txt.bz2 > >>>> > >>>> 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