os.path.expanduser analogue

Brandon Allbery allbery.b at gmail.com
Tue Nov 22 20:28:42 CET 2011


On Tue, Nov 22, 2011 at 09:36, Twan van Laarhoven <twanvl at gmail.com> wrote:

> On 21/11/11 02:36, Ben Gamari wrote:
>
>> On the whole, the filepath package does an excellent job of providing
>> basic path manipulation tools, one weakness is the inability to resolve
>> "~/..." style POSIX paths. Python implements this with
>> os.path.expanduser. Perhaps a similar function might be helpful in
>> filepath?
>>
>
> On windows there are folders like %UserProfile% and %ProgramFiles%. There
> is a function in the API, ExpandEnvironmentStrings, for expanding them.
>

On Unix/POSIX, environment variables in file paths are typically not
handled as widely as tilde expansion, or by the same facilities (for one
thing, envar expansion is applicable to general strings, not just file
paths; I think this is also true on Windows).  This is not to say that such
a facility shouldn't exist in the standard libraries, but that filepath
isn't really the place for it.

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20111122/f294da11/attachment.htm>


More information about the Libraries mailing list