diff options
author | Guido van Rossum <guido@python.org> | 1997-12-03 22:34:03 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-12-03 22:34:03 (GMT) |
commit | 3fa440ea9198b1d1549ab8caf9f263d2f06c608f (patch) | |
tree | 6e1676b0080c139b0193bfc0c9c7d31a22130a38 | |
parent | 7c4cba8325cefae4043bda69aa3dc83a8c015256 (diff) | |
download | cpython-3fa440ea9198b1d1549ab8caf9f263d2f06c608f.zip cpython-3fa440ea9198b1d1549ab8caf9f263d2f06c608f.tar.gz cpython-3fa440ea9198b1d1549ab8caf9f263d2f06c608f.tar.bz2 |
Refinement of home for NT, courtesy Jeff Bauer.
-rw-r--r-- | Lib/user.py | 11 |
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: |