1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

fix error when deleting empty directories

This commit is contained in:
Cornelius Mika 2017-08-17 10:16:31 +02:00
parent 3ef56576d3
commit fcf9f8cf58

View file

@ -317,15 +317,11 @@ in
$DRY_RUN_CMD rm $VERBOSE_ARG "$targetPath" $DRY_RUN_CMD rm $VERBOSE_ARG "$targetPath"
targetDir="$(dirname "$targetPath")" targetDir="$(dirname "$targetPath")"
# Recursively remove the containing directory. We only # Recursively remove empty parent directories.
# do this if the containing folder is not $HOME since while [[ "$targetDir" != "$HOME" && ! "$(ls -A "$targetDir")" ]]; do
# running rmdir on $HOME will result in a harmless but $DRY_RUN_CMD rmdir $VERBOSE_ARG "$targetDir"
# unpleasant error message. targetDir="$(dirname "$targetDir")"
if [[ "$targetDir" != "$HOME" ]] ; then done
$DRY_RUN_CMD rmdir $VERBOSE_ARG \
-p --ignore-fail-on-non-empty \
"$targetDir"
fi
fi fi
done done
''; '';