Move existence check into helper script

This way, it'll run as `root`, too.
This commit is contained in:
Lucendio 2021-03-17 01:33:56 +01:00
parent 7a22cda8dd
commit aceb021254

View File

@ -111,6 +111,10 @@ module Cask
set -euo pipefail set -euo pipefail
for path in "${@}"; do for path in "${@}"; do
if [[ ! -e "${path}" ]]; then
continue
fi
if [[ -e "${path}/.DS_Store" ]]; then if [[ -e "${path}/.DS_Store" ]]; then
/bin/rm -f "${path}/.DS_Store" /bin/rm -f "${path}/.DS_Store"
fi fi
@ -135,8 +139,6 @@ module Cask
sig { params(path: T.any(Pathname, T::Array[Pathname])).void } sig { params(path: T.any(Pathname, T::Array[Pathname])).void }
def rmdir(path) def rmdir(path)
return unless path.exist?
@command.run!( @command.run!(
"/usr/bin/xargs", "/usr/bin/xargs",
args: ["-0", "--", "/bin/bash", "-c", RMDIR_SH, "--"], args: ["-0", "--", "/bin/bash", "-c", RMDIR_SH, "--"],