Commit d8f0edfc by devttys0

Updated _get_user_dir to handle situations with no $HOME directory

parent 298cc28d
...@@ -128,10 +128,15 @@ class Settings: ...@@ -128,10 +128,15 @@ class Settings:
''' '''
try: try:
# This should work in both Windows and Unix environments # This should work in both Windows and Unix environments
return os.getenv('USERPROFILE') or os.getenv('HOME') for envname in ['USERPROFILE', 'HOME']:
user_dir = os.getenv(envname)
if user_dir is not None:
return user_dir
except KeyboardInterrupt as e: except KeyboardInterrupt as e:
raise e raise e
except Exception: except Exception:
pass
return '' return ''
def _file_path(self, dirname, filename): def _file_path(self, dirname, filename):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment