Skip to content

Commit

Permalink
Merge pull request #25 from BonnierNews/add_argument_for_ignoring_use…
Browse files Browse the repository at this point in the history
…r_files

Add argument for ignoring user files
  • Loading branch information
macbofh authored Nov 3, 2024
2 parents 2ef7894 + 5b8f95c commit 7b842ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions fragments/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ swiftDialogNotification=mini
appVersionKey="CFBundleShortVersionString"
appBundleIdentifierKey="CFBundleIdentifier"

# ignore deletion of files in user directories
IGNORE_USER_DIRS=0
# options:
# 0 delete files/directories in user directories
# 1 ignore deletion of files in user directories, with exception of LaunchAgents
16 changes: 10 additions & 6 deletions fragments/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ fi
for file in "${appFiles[@]}"
do
if [[ "$file" == *"<<Users>>"* ]]; then
# remove path with expanded path for all available userfolders
for userfolder in $(ls /Users)
do
expandedPath=$(echo $file | sed "s|<<Users>>|/Users/$userfolder|g")
removeFileDirectory "$expandedPath" silent
done
if [[ $IGNORE_USER_DIRS == 0 ]]; then
# remove path with expanded path for all available userfolders
for userfolder in $(ls /Users)
do
expandedPath=$(echo $file | sed "s|<<Users>>|/Users/$userfolder|g")
removeFileDirectory "$expandedPath" silent
done
else
printlog "Ignoring deletion of user files: $file"
fi
else
# remove real path
removeFileDirectory "$file"
Expand Down

0 comments on commit 7b842ef

Please sign in to comment.