cask/artifact/moved: fix permission handling when removing directories
This commit is contained in:
parent
a3e5e3f7a0
commit
011dfc8f45
@ -181,14 +181,8 @@ module Cask
|
|||||||
# If an app folder is deleted, macOS considers the app uninstalled and removes some data.
|
# If an app folder is deleted, macOS considers the app uninstalled and removes some data.
|
||||||
# Remove only the contents to handle this case.
|
# Remove only the contents to handle this case.
|
||||||
target.children.each do |child|
|
target.children.each do |child|
|
||||||
if target.writable? && !force
|
|
||||||
child.rmtree
|
|
||||||
else
|
|
||||||
Utils.gain_permissions_remove(child, command:)
|
Utils.gain_permissions_remove(child, command:)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
elsif target.parent.writable? && !force
|
|
||||||
target.rmtree
|
|
||||||
else
|
else
|
||||||
Utils.gain_permissions_remove(target, command:)
|
Utils.gain_permissions_remove(target, command:)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -273,7 +273,7 @@ RSpec.describe Cask::Artifact::App, :cask do
|
|||||||
|
|
||||||
FileUtils.chmod 0544, target_path
|
FileUtils.chmod 0544, target_path
|
||||||
|
|
||||||
expect { uninstall_phase }.to raise_error(Errno::ENOTEMPTY)
|
uninstall_phase
|
||||||
|
|
||||||
expect(source_path).to be_a_directory
|
expect(source_path).to be_a_directory
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user