From 2e483733055cca0d9167e1caf422f97986e71016 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 1 Aug 2018 07:41:52 +0200 Subject: [PATCH] Use `ditto` instead of `unzip`. --- Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb | 9 +++++++++ Library/Homebrew/unpack_strategy/zip.rb | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb 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 df3a0c1220..4ba3f77a26 100644 --- a/Library/Homebrew/unpack_strategy/zip.rb +++ b/Library/Homebrew/unpack_strategy/zip.rb @@ -14,3 +14,5 @@ module UnpackStrategy end end end + +require "extend/os/mac/unpack_strategy/zip" if OS.mac?