Created
June 11, 2014 13:40
-
-
Save pvdb/8d03156d2c7d1e59b4cb to your computer and use it in GitHub Desktop.
Get current user's home directory, even if ${HOME} isn't set in env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as a String | |
HOME = ENV['HOME'] || File.expand_path("~#{Etc.getlogin}") | |
# as a Pathname | |
HOME = Pathname.new(ENV['HOME'] || File.expand_path("~#{Etc.getlogin}")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment