Merge pull request #5020 from amyspark/repair-xattr
zip: restore extended attributes when under MacOS
This commit is contained in:
commit
e0b0e22210
@ -2,10 +2,21 @@ module UnpackStrategy
|
|||||||
class Zip
|
class Zip
|
||||||
prepend Module.new {
|
prepend Module.new {
|
||||||
def extract_to_dir(unpack_dir, basename:, verbose:)
|
def extract_to_dir(unpack_dir, basename:, verbose:)
|
||||||
volumes = super.stderr.chomp
|
result = super
|
||||||
.split("\n")
|
|
||||||
.map { |l| l[/\A skipping: (.+) volume label\Z/, 1] }
|
volumes = result.stderr.chomp
|
||||||
.compact
|
.split("\n")
|
||||||
|
.map { |l| l[/\A skipping: (.+) volume label\Z/, 1] }
|
||||||
|
.compact
|
||||||
|
|
||||||
|
if result.stderr.lines.any? { |line| line.start_with?("._") }
|
||||||
|
# Merge ._ files back into extended attributes.
|
||||||
|
# ._ files inside volumes are automatically merged by ditto.
|
||||||
|
system_command!("dot_clean",
|
||||||
|
args: ["-mv", "--keep=dotbar", unpack_dir],
|
||||||
|
verbose: verbose,
|
||||||
|
print_stderr: false)
|
||||||
|
end
|
||||||
|
|
||||||
return if volumes.empty?
|
return if volumes.empty?
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user