def _get_home_dir():
''' Try to find user's home directory, otherwise return current directory.'''
path1 = os.path.expanduser("~")
try:
path2 = os.environ["HOME"]
except KeyError:
path2 = ""
try:
path3 = os.environ["USERPROFILE"]
except KeyError:
path3 = ""
if not os.path.exists(path1):
if not os.path.exists(path2):
if not os.path.exists(path3):
return os.getcwdu()
else: return path3
else: return path2
else: return path1
评论列表
文章目录