On Apr 28, 2007, at 9:52 PM, Eric Wilhelm wrote:
Maybe we do "s/(~\w*(?:/|$))//" and then "glob($1) . $_" ? Does that
cover everything? (Well, everything except the backslash duality
issue
on windows.) If people want "~my user name is cool/" to work, I don't
think I can bring myself to think about it.
Yeah, me neither.
Here's what MakeMaker does, which is pretty close to that, but
doesn't invoke the shell:
if ($value =~ m/^~(\w+)?/) { # tilde with optional username
$value =~ s [^~(\w*)]
[$1 ?
((getpwnam($1))[7] || "~$1") :
(getpwuid($>))[7]
]ex;
}
We should probably just steal it out of there, since at least then
we'll be consistent.
Can you verify that on Windows (getpwuid $>)[7] returns $ENV{HOME} if
set? Or at least something reasonable? Or even if it doesn't, we
can easily just override _detildefy in the Windows subclass.
-Ken