mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
fix error when deleting empty directories
This commit is contained in:
parent
3ef56576d3
commit
fcf9f8cf58
1 changed files with 5 additions and 9 deletions
|
@ -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
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue