summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-03 22:34:03 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-03 22:34:03 (GMT)
commit3fa440ea9198b1d1549ab8caf9f263d2f06c608f (patch)
tree6e1676b0080c139b0193bfc0c9c7d31a22130a38 /Lib
parent7c4cba8325cefae4043bda69aa3dc83a8c015256 (diff)
downloadcpython-3fa440ea9198b1d1549ab8caf9f263d2f06c608f.zip
cpython-3fa440ea9198b1d1549ab8caf9f263d2f06c608f.tar.gz
cpython-3fa440ea9198b1d1549ab8caf9f263d2f06c608f.tar.bz2
Refinement of home for NT, courtesy Jeff Bauer.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/user.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/user.py b/Lib/user.py
index 0628787..125a7a2 100644
--- a/Lib/user.py
+++ b/Lib/user.py
@@ -23,10 +23,15 @@ wishes to do different things depending on the Python version.
import os
-try:
+home = os.curdir # Default
+if os.environ.has_key('HOME'):
home = os.environ['HOME']
-except:
- home = os.curdir
+elif os.name == 'nt': # Contributed by Jeff Bauer
+ if os.environ.has_key('HOMEPATH'):
+ if os.environ.has_key('HOMEDRIVE'):
+ home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']
+ else:
+ home = os.environ['HOMEPATH']
pythonrc = os.path.join(home, ".pythonrc.py")
try: