delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/02/14/16:51: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:mime-version:references:in-reply-to:from:date
:message-id:subject:to:content-type; q=dns; s=default; b=gFEwu6l
szjxTsXY4/H8q75RgriwJ0kehBTfD9YMmx2fm13LEQ1h4F9D1k/OsvSQw68aEW0P
IzkPKlratfWEECog3OiRYAGd8Jpc3q+bRAiBYsmm4yWg7vsV3bsQ623a+/KLyvR3
nJXUIywK6NfMEt8vF1GL9EpHx/fj8t2ttofQ=
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:references:in-reply-to:from:date
:message-id:subject:to:content-type; s=default; bh=wmpUWcKWwmDs7
bmJwhMMNBqPT2E=; b=d4N9o5kQdUkazPOZiRdXmD3I6tcc+ucwUSz4bcRU0bQN8
MFEpgokOKYBAuGa5BFPW1LYZ8W+SIMCaVHrMt2Yko9HoLLUixbwj4swjIGCQTbdW
Z3ZEkVFVZNzJ/ese9iz8L3mFyQRDiYbFim8OqrzuTItBqgNQAwn/3oYI7JSh/o=
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-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1118, determines
X-HELO: mout.gmx.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.com; s=dbd5af2cbaf7; t=1550181089; bh=l5CwyvIlp26S7jKPLtIAw85XbCiboDMQUxNfG97Cef4=; h=X-UI-Sender-Class:References:In-Reply-To:From:Date:Subject:To; b=MCv9qpSj5gPSMa0upnCOjOOiRCbkUMaO856uTerpl70LApmauXuXWbIjEDCYScilF RxyX61kwc8t0nKzwjw2vF4FCrj7AfxM7IO2XrUo4BF1VkYvM1Qr2X7Q4Anfc7NdkxF 9wbj1/iF/GWejEj9zZYhVGmqHABdQVq9KprtsSKs=
X-UI-Sender-Class: 214d933f-fd2f-45c7-a636-f5d79ae31a79
MIME-Version: 1.0
References: <CANV9t=R83dQddZOVWVUg55t7K=DUyE8BiQ10Pn1v4G+xcgPh3w AT mail DOT gmail DOT com> <9539a1e8-e893-3175-f96c-fb4ad172702c AT redhat DOT com> <CANV9t=R-1XE-cyKa5vtvtu_3dJiYoLRstBTN86JiQ2FS2T+Jyw AT mail DOT gmail DOT com> <2a87c6c0-6a0f-6994-3620-8b0b722d7d49 AT redhat DOT com>
In-Reply-To: <2a87c6c0-6a0f-6994-3620-8b0b722d7d49@redhat.com>
From: Bill Stewart <bstewart AT iname DOT com>
Date: Thu, 14 Feb 2019 14:51:15 -0700
Message-ID: <CANV9t=QXVTGF0uS+vNCmkrxNOV7GVAsO_5hTS9hizX0tnW=-PA@mail.gmail.com>
Subject: Re: Get Cygwin home directory path for current user
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

On Thu, Feb 14, 2019 at 2:15 PM Eric Blake wrote:

> If you want tilde-expansion to happen, you have to use a shell that does
> tilde-expansion. bash and dash do, PowerShell does not.  It is not
> cygpath's fault, but your choice of shell, that determines whether ~ is
> expanded.  And, since the tilde-expansion of ~ is $HOME, and PowerShell
> _does_ support $HOME, use $HOME instead of relying on tilde-expansion.
> (The expansion of ~user is a much harder nut to crack - for that, you
> really do depend on a shell doing proper tilde-expansion, as there are
> no easy shortcuts)

The only problem with that is that PowerShell $HOME is not always
equivalent to Cygwin ~ .

For example, if the Windows user has a home drive and directory
specified in the profile, Cygwin ~ will point there rather than
PowerShell $HOME (which points at the user's profile directory).

I can make do with /bin/dash -c 'cygpath -aw ~' - from the Windows
side, but this makes me spawn two executables and seems like
unnecessary overhead.

Seems like there must be a better way...

Bill

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