keg: try to avoid disk IO when possible

Calling Pathname#text_executable? reads in the first 1024 bytes of the
file, so try the basename check (which requires no filesystem access)
first.
This commit is contained in:
Jack Nagel 2013-12-14 09:35:57 -06:00
parent 24d8791dfb
commit 7a10493387

View File

@ -181,7 +181,7 @@ class Keg
# find name-config scripts, which can be all over the keg # find name-config scripts, which can be all over the keg
Pathname.new(self).find do |pn| Pathname.new(self).find do |pn|
next if pn.symlink? or pn.directory? next if pn.symlink? or pn.directory?
pkgconfig_files << pn if pn.text_executable? and pn.basename.to_s.end_with? '-config' pkgconfig_files << pn if pn.basename.to_s.end_with? '-config' and pn.text_executable?
end end
pkgconfig_files pkgconfig_files
end end