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: List-Subscribe: List-Archive: List-Post: List-Help: , 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: References: <6e5968a1-a667-f911-fbec-f83e4ef34608 AT redhat DOT com> <887116862 DOT 20161208214534 AT yandex DOT ru> From: Dipak Gaigole Date: Fri, 9 Dec 2016 12:54:07 +0530 Message-ID: Subject: Re: Problem with chdir and GetCurrentDirectory on Windows 2016 To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 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