astropy/astropy — pull request #1897 by embray (2013-12-11 22:48:17+00:00)
Title: Better support for $HOME in msys shells on Windows

If running in an msys shell, use the /home/embray environment variable set in that shell to find the user's home. The surest way to determine this is if the MSYSTEM environment variable is set (it doesn't matter what it's set to). Obviously this isn't foolproof but there are few better alternatives (one might be to try calling 'uname').

This specifically came up because some versions of msys (including the one I have installed) screw up the `$HOMEPATH` environment variable such that the `.astropy` directory ends up being created in `C:\.astropy` (if you even have permission to write there, if not it blows up).