From a6bcbdb20d669520a595efd268c3b3fc6e57e0ba Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Wed, 19 Dec 2018 20:00:14 -0500 Subject: [PATCH] mac/keg_relocate: Prefer String#/, add ENV check --- Library/Homebrew/extend/os/mac/keg_relocate.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index c098ff2fdb..a68b7690fd 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -79,10 +79,10 @@ class Keg suffix = bad_name.sub(/^@rpath/, "") # short circuit: we expect lib to be usually correct, so we try it first - return (lib + suffix) if (lib + suffix).exist? + return (lib / suffix) if (lib / suffix).exist? file.rpaths.each do |rpath| - return (rpath + suffix) if (rpath + suffix).exist? + return (rpath / suffix) if (rpath / suffix).exist? end opoo "Could not expand an RPATH in #{file}" @@ -101,7 +101,7 @@ class Keg "@loader_path/#{bad_name}" elsif file.mach_o_executable? && (lib + bad_name).exist? "#{lib}/#{bad_name}" - elsif bad_name.start_with? "@rpath" + elsif bad_name.start_with? "@rpath" && ENV["HOMEBREW_RELOCATE_RPATHS"] expand_rpath bad_name elsif (abs_name = find_dylib(bad_name)) && abs_name.exist? abs_name.to_s