From 357d0f279614c1c18f709f2dd4e310ad388d3915 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sat, 7 Feb 2015 13:20:10 -0500 Subject: [PATCH] Use start_with? to simplify path sanity check --- Library/ENV/4.3/cc | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 4ab9dc6711..65a95d3735 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -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