diff --git a/libraries/util.bash b/libraries/util.bash index 2cef19cf..fb2e4877 100755 --- a/libraries/util.bash +++ b/libraries/util.bash @@ -759,6 +759,32 @@ function getGitRepositoryNameFromCloneURL() # MAC UTILITIES # ################# +function clearMacAppExtendedAttributes() +{ + local -r headerMessage="${1}" + local -r applicationPaths=("${@:2}") + + checkRequireMacSystem + + if [[ "${#applicationPaths[@]}" -gt '0' ]] + then + header "${headerMessage}" + fi + + local applicationPath='' + + for applicationPath in "${applicationPaths[@]}" + do + # Find Non-Default Apple App + + if [[ "$(ls -d -l -O "${applicationPath}" | grep -E '\s+restricted\s+')" = '' ]] + then + info "clearing extended attributes of '${applicationPath}'" + xattr -c -r -s "${applicationPath}" + fi + done +} + function closeMacApplications() { local -r headerMessage="${1}" @@ -791,6 +817,18 @@ function closeMacApplications() done } +function getMacCurrentUserICloudDriveFolderPath() +{ + local -r iCloudFolderPath="$(getCurrentUserHomeFolder)/Library/Mobile Documents/com~apple~CloudDocs" + + if [[ -d "${iCloudFolderPath}" ]] + then + echo "${iCloudFolderPath}" + else + echo + fi +} + function openMacApplications() { local -r headerMessage="${1}" @@ -812,32 +850,6 @@ function openMacApplications() done } -function clearMacAppExtendedAttributes() -{ - local -r headerMessage="${1}" - local -r applicationPaths=("${@:2}") - - checkRequireMacSystem - - if [[ "${#applicationPaths[@]}" -gt '0' ]] - then - header "${headerMessage}" - fi - - local applicationPath='' - - for applicationPath in "${applicationPaths[@]}" - do - # Find Non-Default Apple App - - if [[ "$(ls -d -l -O "${applicationPath}" | grep -E '\s+restricted\s+')" = '' ]] - then - info "clearing extended attributes of '${applicationPath}'" - xattr -c -r -s "${applicationPath}" - fi - done -} - #################### # NUMBER UTILITIES # ####################