cask/artifact/moved: fix permission handling when removing directories

This commit is contained in:
Bo Anderson 2024-03-15 03:26:21 +00:00
parent a3e5e3f7a0
commit 011dfc8f45
No known key found for this signature in database
2 changed files with 2 additions and 8 deletions

View File

@ -181,14 +181,8 @@ module Cask
# If an app folder is deleted, macOS considers the app uninstalled and removes some data.
# Remove only the contents to handle this case.
target.children.each do |child|
if target.writable? && !force
child.rmtree
else
Utils.gain_permissions_remove(child, command:)
end
Utils.gain_permissions_remove(child, command:)
end
elsif target.parent.writable? && !force
target.rmtree
else
Utils.gain_permissions_remove(target, command:)
end

View File

@ -273,7 +273,7 @@ RSpec.describe Cask::Artifact::App, :cask do
FileUtils.chmod 0544, target_path
expect { uninstall_phase }.to raise_error(Errno::ENOTEMPTY)
uninstall_phase
expect(source_path).to be_a_directory
end