diff options
| author | Ellen Marie Dash <me@duckie.co> | 2023-10-06 19:18:07 -0400 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-10-16 13:51:09 +0900 |
| commit | f37e9f42b95e033ec557fa3bf68282dd823ee199 (patch) | |
| tree | f6de962da35f7f7190098e319d005c5184709720 | |
| parent | 45a5ea5a0ac36d8cce05167cebcc2a0812c90019 (diff) | |
[rubygems/rubygems] [PathSupport] Simplify logic: If `Gem.default_dir` is writable, use it.
I couldn't find a cross-platform way to check "can I create this directory?"
So I removed that, and went back to the original simpler logic of
"if the directory is writable, use it."
https://github.com/rubygems/rubygems/commit/3aa86a56db
| -rw-r--r-- | lib/rubygems/path_support.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb index f27da619e9..b966e15f9c 100644 --- a/lib/rubygems/path_support.rb +++ b/lib/rubygems/path_support.rb @@ -30,15 +30,12 @@ class Gem::PathSupport def initialize(env) # Current implementation of @home, which is exposed as `Gem.paths.home`: # 1. If `env["GEM_HOME"]` is defined in the environment: `env["GEM_HOME"]`. - # 2. If `Gem.default_dir` is writable OR it does not exist and it's parent - # directory is writable: `Gem.default_dir`. + # 2. If `Gem.default_dir` is writable: `Gem.default_dir`. # 3. Otherwise: `Gem.user_dir`. if env.key?("GEM_HOME") @home = normalize_home_dir(env["GEM_HOME"]) - elsif File.writable?(Gem.default_dir) || \ - (!File.exist?(Gem.default_dir) && File.writable?(File.expand_path("..", Gem.default_dir))) - + elsif File.writable?(Gem.default_dir) @home = normalize_home_dir(Gem.default_dir) else # If `GEM_HOME` is not set AND we can't use `Gem.default_dir`, |
