Method: Bundler::Thor::Util.user_home

Defined in:
lib/bundler/vendor/thor/lib/thor/util.rb

.user_homeObject

[View source]

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/bundler/vendor/thor/lib/thor/util.rb', line 168

def user_home
  @@user_home ||= if ENV["HOME"]
    ENV["HOME"]
  elsif ENV["USERPROFILE"]
    ENV["USERPROFILE"]
  elsif ENV["HOMEDRIVE"] && ENV["HOMEPATH"]
    File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"])
  elsif ENV["APPDATA"]
    ENV["APPDATA"]
  else
    begin
      File.expand_path("~")
    rescue
      if File::ALT_SEPARATOR
        "C:/"
      else
        "/"
      end
    end
  end
end