1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add fallback when PWD is not set

This commit is contained in:
Kazuhiro NISHIYAMA 2021-01-28 18:23:13 +09:00
parent 763d242fcd
commit 1b377b32c8
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A

View file

@ -1340,8 +1340,12 @@ end
# override the default gem.
def load_path_exclusions_hack_for(name)
if ruby_core?
# .ext/common is relative from build directory
ext_folder = Pathname(ENV["PWD"]) + ".ext/common"
if ENV.key?("PWD")
# .ext/common is relative from build directory
ext_folder = Pathname(ENV["PWD"]) + ".ext/common"
else
ext_folder = source_root.join(".ext/common")
end
require_name = name.tr("-", "/")
if File.exist?(ext_folder.join("#{require_name}.rb"))
{ :exclude_from_load_path => ext_folder.to_s }