Use start_with? to simplify path sanity check

This commit is contained in:
Jack Nagel 2015-02-07 13:20:10 -05:00
parent f438af9915
commit 357d0f2796

View File

@ -199,15 +199,7 @@ class Cmd
end
def keep? path
case path
when %r{^#{Regexp.escape(prefix)}}o, %r{^#{Regexp.escape(cellar)}}o, %r{^#{Regexp.escape(tmpdir)}}o
# maybe homebrew is installed to /sw or /opt/brew
true
when %r{^/opt}, %r{^/sw}, %r{/usr/X11}
false
else
true
end
path.start_with?(prefix, cellar, tmpdir) || !path.start_with?("/opt", "/sw", "/usr/X11")
end
def cflags