Class: Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/cheatorious.rb

Class Method Summary collapse

Class Method Details

.homeObject



12
13
14
15
16
17
18
# File 'lib/cheatorious.rb', line 12

def self.home
  ['HOME', 'USERPROFILE'].each {|e| return ENV[e] if ENV[e] }
  return "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}" if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
  File.expand_path("~")
rescue
  File::ALT_SEPARATOR ? "C:/" : "/"
end