Getting current user home directory in OS X?

How to find current user home directory in OS X?

HOME environment variable is not always set, for example, when you do not start the console (GUI applications).

For this reason, I am looking for a universal solution that will os.environ['HOME'] if os.environ['HOME'] not installed.

There is a similar question (C) , but it already has a decision that is not valid.

A Python solution would be preferable, but other languages ​​are welcome as they provide a real home or at least one place where you can write.

+1
home-directory macos
source share
1 answer

It seems that os.path.expanduser("~") always returns the home directory even on Windows.

+1
source share

All Articles