Skip to content

Commit

Permalink
update lib
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbtek committed Feb 4, 2019
1 parent 20c375d commit ec7aa81
Showing 1 changed file with 38 additions and 26 deletions.
64 changes: 38 additions & 26 deletions libraries/util.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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}"
Expand All @@ -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 #
####################
Expand Down

0 comments on commit ec7aa81

Please sign in to comment.