Skip to content

Commit cfe9516

Browse files
authored
Merge pull request #9712 from nobu/cache-expanded-base-path
Avoid repeated base path expansion
2 parents e920104 + dd8b072 commit cfe9516

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/rubygems/util.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ def self.traverse_parents(directory, &block)
8181
# +base_path+ are not treated as part of the pattern.
8282

8383
def self.glob_files_in_dir(glob, base_path)
84-
Dir.glob(glob, base: base_path).map! {|f| File.expand_path(f, base_path) }
84+
expanded_path = nil
85+
Dir.glob(glob, base: base_path).map! do |f|
86+
File.expand_path(f, expanded_path ||= File.expand_path(base_path))
87+
end
8588
end
8689

8790
##

0 commit comments

Comments
 (0)