diff --git a/Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb b/Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb new file mode 100644 index 0000000000..e31d2c3756 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb @@ -0,0 +1,9 @@ +module UnpackStrategy + class Zip + def extract_to_dir(unpack_dir, basename:, verbose:) + # `ditto` keeps Finder attributes intact and does not skip volume labels + # like `unzip` does, which can prevent disk images from being unzipped. + system_command! "ditto", args: ["-x", "-k", path, unpack_dir] + end + end +end diff --git a/Library/Homebrew/unpack_strategy/zip.rb b/Library/Homebrew/unpack_strategy/zip.rb index d8188447ba..ade45f6302 100644 --- a/Library/Homebrew/unpack_strategy/zip.rb +++ b/Library/Homebrew/unpack_strategy/zip.rb @@ -20,3 +20,5 @@ module UnpackStrategy end end end + +require "extend/os/mac/unpack_strategy/zip" if OS.mac?