diff options
Diffstat (limited to 'lib/rubygems/util.rb')
-rw-r--r-- | lib/rubygems/util.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb index 9f5b9a2239..6dbcd4ba21 100644 --- a/lib/rubygems/util.rb +++ b/lib/rubygems/util.rb @@ -80,8 +80,6 @@ module Gem::Util end return system(*(cmds << opt)) rescue TypeError - require 'thread' - @silent_mutex ||= Mutex.new @silent_mutex.synchronize do @@ -118,4 +116,16 @@ module Gem::Util end end + ## + # Globs for files matching +pattern+ inside of +directory+, + # returning absolute paths to the matching files. + + def self.glob_files_in_dir(glob, base_path) + if RUBY_VERSION >= "2.5" + Dir.glob(glob, base: base_path).map! {|f| File.join(base_path, f) } + else + Dir.glob(File.expand_path(glob, base_path)) + end + end + end |