Web lists-archives.com

Re: Get Cygwin home directory path for current user




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