os/mac: use start_with? when possible
Closes Homebrew/homebrew#48071. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
This commit is contained in:
parent
7faae5adf2
commit
92a71a534f
@ -141,7 +141,7 @@ module OS
|
||||
@gcc_42_build_version ||=
|
||||
begin
|
||||
gcc = MacOS.locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2")
|
||||
if gcc.exist? && gcc.realpath.basename.to_s !~ /^llvm/
|
||||
if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm")
|
||||
`#{gcc} --version`[/build (\d{4,})/, 1].to_i
|
||||
end
|
||||
end
|
||||
@ -150,7 +150,7 @@ module OS
|
||||
|
||||
def llvm_build_version
|
||||
@llvm_build_version ||=
|
||||
if (path = locate("llvm-gcc")) && path.realpath.basename.to_s !~ /^clang/
|
||||
if (path = locate("llvm-gcc")) && !path.realpath.basename.to_s.start_with?("clang")
|
||||
`#{path} --version`[/LLVM build (\d{4,})/, 1].to_i
|
||||
end
|
||||
end
|
||||
|
||||
@ -141,9 +141,9 @@ module OS
|
||||
|
||||
def default_prefix?
|
||||
if version < "4.3"
|
||||
%r{^/Developer} === prefix
|
||||
prefix.to_s.start_with? "/Developer"
|
||||
else
|
||||
%r{^/Applications/Xcode.app} === prefix
|
||||
prefix.to_s.start_with? "/Applications/Xcode.app"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user