diff options
author | Georg Brandl <georg@python.org> | 2007-03-13 22:07:36 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-03-13 22:07:36 (GMT) |
commit | 03b90d8cfde0e74ec633f79201b53aada21bf42c (patch) | |
tree | f546d8e0e2a3f48a588ca1473df901562dc59da2 /Doc/lib/libposixpath.tex | |
parent | b6ae6aa8ac8abb9350f2ae2186d609116676c661 (diff) | |
download | cpython-03b90d8cfde0e74ec633f79201b53aada21bf42c.zip cpython-03b90d8cfde0e74ec633f79201b53aada21bf42c.tar.gz cpython-03b90d8cfde0e74ec633f79201b53aada21bf42c.tar.bz2 |
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
Diffstat (limited to 'Doc/lib/libposixpath.tex')
-rw-r--r-- | Doc/lib/libposixpath.tex | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Doc/lib/libposixpath.tex b/Doc/lib/libposixpath.tex index 1dbe32f..3687c6d 100644 --- a/Doc/lib/libposixpath.tex +++ b/Doc/lib/libposixpath.tex @@ -58,18 +58,20 @@ Equivalent to \function{exists()} on platforms lacking \end{funcdesc} \begin{funcdesc}{expanduser}{path} -On \UNIX, return the argument with an initial component of \samp{\~} or -\samp{\~\var{user}} replaced by that \var{user}'s home directory. -An initial \samp{\~} is replaced by the environment variable +On \UNIX and Windows, return the argument with an initial component of +\samp{\~} or \samp{\~\var{user}} replaced by that \var{user}'s home directory. + +On \UNIX, an initial \samp{\~} is replaced by the environment variable \envvar{HOME} if it is set; otherwise the current user's home directory is looked up in the password directory through the built-in module \refmodule{pwd}\refbimodindex{pwd}. An initial \samp{\~\var{user}} is looked up directly in the password directory. -On Windows, only \samp{\~} is supported; it is replaced by the -environment variable \envvar{HOME} or by a combination of -\envvar{HOMEDRIVE} and \envvar{HOMEPATH}. +On Windows, \envvar{HOME} and \envvar{USERPROFILE} will be used if set, +otherwise a combination of \envvar{HOMEPATH} and \envvar{HOMEDRIVE} will be +used. An initial \samp{\~\var{user}} is handled by stripping the last +directory component from the created user path derived above. If the expansion fails or if the path does not begin with a tilde, the path is returned unchanged. @@ -81,6 +83,9 @@ of the form \samp{\$\var{name}} or \samp{\$\{\var{name}\}} are replaced by the value of environment variable \var{name}. Malformed variable names and references to non-existing variables are left unchanged. + +On Windows, \samp{\%\var{name}\%} expansions are supported in addition to +\samp{\$\var{name}} and \samp{\$\{\var{name}\}}. \end{funcdesc} \begin{funcdesc}{getatime}{path} |