]> granicus.if.org Git - python/commitdiff
Refinement of home for NT, courtesy Jeff Bauer.
authorGuido van Rossum <guido@python.org>
Wed, 3 Dec 1997 22:34:03 +0000 (22:34 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 3 Dec 1997 22:34:03 +0000 (22:34 +0000)
Lib/user.py

index 062878717241a966d89f180c11a7236cbbdcd749..125a7a267e8e2f8ffb64e5cee50d8e7300a678ad 100644 (file)
@@ -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: