diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-04 08:07:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-04 08:07:22 +0000 |
commit | 8af0e113f698ffb59e63f7bdc2f6c79a0cc94e8d (patch) | |
tree | 63b858e2377c62dc8037d0dfbe83c2422f4ba6f1 /lib | |
parent | a91ce21ec22cec9fbc4c3a05ae8f66d295e54109 (diff) | |
download | ruby-8af0e113f698ffb59e63f7bdc2f6c79a0cc94e8d.tar.gz ruby-8af0e113f698ffb59e63f7bdc2f6c79a0cc94e8d.tar.xz ruby-8af0e113f698ffb59e63f7bdc2f6c79a0cc94e8d.zip |
* lib/rubygems.rb (Gem.set_home, Gem.set_paths): should not create
directories stealthily. [ruby-core:20990]
* lib/rubygems.rb (Gem.find_home): expand_path deals with platform
dependent envirionments.
* lib/rdoc/ri/paths.rb (RDoc::HOMEDIR): ditto.
* instruby.rb (gem): creates gem directories at installation.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rdoc/ri/paths.rb | 8 | ||||
-rw-r--r-- | lib/rubygems.rb | 33 |
2 files changed, 7 insertions, 34 deletions
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb index 2f72b9dfd..fcafb279f 100644 --- a/lib/rdoc/ri/paths.rb +++ b/lib/rdoc/ri/paths.rb @@ -31,13 +31,7 @@ module RDoc::RI::Paths base = File.join(RbConfig::CONFIG['datadir'], "ri", VERSION) SYSDIR = File.join(base, "system") SITEDIR = File.join(base, "site") - homedir = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH'] - - if homedir then - HOMEDIR = File.join(homedir, ".rdoc") - else - HOMEDIR = nil - end + HOMEDIR = (File.expand_path("~/.rdoc") rescue nil) begin require 'rubygems' unless defined?(Gem) and defined?(Gem::Enable) and diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 9913b59ce..77930016f 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -373,22 +373,12 @@ module Gem # least on Win32). def self.find_home - ['HOME', 'USERPROFILE'].each do |homekey| - return ENV[homekey] if ENV[homekey] - end - - if ENV['HOMEDRIVE'] && ENV['HOMEPATH'] then - return "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}" - end - - begin - File.expand_path("~") - rescue - if File::ALT_SEPARATOR then - "C:/" - else - "/" - end + File.expand_path("~") + rescue + if File::ALT_SEPARATOR then + "C:/" + else + "/" end end @@ -691,7 +681,6 @@ module Gem def self.set_home(home) home = home.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR @gem_home = home - ensure_gem_subdirectories(@gem_home) end private_class_method :set_home @@ -716,16 +705,6 @@ module Gem end @gem_path.uniq! - @gem_path.each do |path| - if 0 == File.expand_path(path).index(Gem.user_home) - next unless File.directory? Gem.user_home - unless win_platform? then - # only create by matching user - next if Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid - end - end - ensure_gem_subdirectories path - end end private_class_method :set_paths |