formula: make prefix usually return opt_prefix.
Return `opt_prefix` if it exists and `prefix` is not called from within the same formula's `install` or `post_install` methods. Otherwise, fall back to the existing functionality. This avoids the need to use `opt_prefix` etc. everywhere and generally means we don't expose an implementation detail (i.e. the full Cellar path) to dependents that have a habit of hard-coding it.
Showing
- Library/Homebrew/cmd/--prefix.rb 1 addition, 1 deletionLibrary/Homebrew/cmd/--prefix.rb
- Library/Homebrew/formula.rb 18 additions, 3 deletionsLibrary/Homebrew/formula.rb
- Library/Homebrew/formula_installer.rb 1 addition, 1 deletionLibrary/Homebrew/formula_installer.rb
- Library/Homebrew/keg.rb 1 addition, 0 deletionsLibrary/Homebrew/keg.rb
Please register or sign in to comment