keg_relocate: refactor path.find change for performance
Closes #616. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
parent
196a6946e1
commit
604f4b6a07
@ -64,12 +64,14 @@ class Keg
|
|||||||
text_files = []
|
text_files = []
|
||||||
return text_files unless File.exist?("/usr/bin/file")
|
return text_files unless File.exist?("/usr/bin/file")
|
||||||
|
|
||||||
|
# file has known issues with reading files on other locales. Has
|
||||||
|
# been fixed upstream for some time, but a sufficiently new enough
|
||||||
|
# file with that fix is only available in macOS Sierra.
|
||||||
|
# http://bugs.gw.com/view.php?id=292
|
||||||
|
with_custom_locale("C") do
|
||||||
path.find do |pn|
|
path.find do |pn|
|
||||||
next if pn.symlink? || pn.directory?
|
next if pn.symlink? || pn.directory?
|
||||||
next if Metafiles::EXTENSIONS.include? pn.extname
|
next if Metafiles::EXTENSIONS.include? pn.extname
|
||||||
# File has known issues with reading files on other locales.
|
|
||||||
# http://bugs.gw.com/view.php?id=292
|
|
||||||
with_custom_locale("C") do
|
|
||||||
if Utils.popen_read("/usr/bin/file", "--brief", pn).include?("text") ||
|
if Utils.popen_read("/usr/bin/file", "--brief", pn).include?("text") ||
|
||||||
pn.text_executable?
|
pn.text_executable?
|
||||||
text_files << pn
|
text_files << pn
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user