- remove all packages except core ones which are dangerous to remove
- iterate over .list files, build list of all files to be removed
- filter out some critical from those
- remove all files and empty directories which are in that list from disk, pop them from that list on removal
- keep doing previous step until list is empty, or there are no empty directories left in it
- print out list leftovers and ask user to handle them manually
Created
February 25, 2018 14:55
-
-
Save stek29/5bfa87fb57f028de2720cac71728a203 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const char* FILE_BLACKLIST[] = { | |
// These most likely won't be empty anyway | |
"Applications", | |
"Library", | |
"Library/Frameworks", | |
"Library/Ringtones", | |
"Library/Wallpaper", | |
"System", | |
"System/Library", | |
"System/Library/Extensions", | |
"System/Library/Fonts", | |
"System/Library/Frameworks", | |
"System/Library/LaunchDaemons", | |
"System/Library/PreferenceBundles", | |
"System/Library/PrivateFrameworks", | |
"System/Library/SystemConfiguration", | |
"bin", | |
"dev", | |
"sbin", | |
"usr", | |
"usr/bin", | |
"usr/lib", | |
"usr/libexec", | |
"usr/local", | |
"usr/sbin", | |
"usr/share", | |
"usr/share/misc", | |
"var/db", | |
"var/log", | |
"var/logs", | |
"var/mobile", | |
"var/mobile/Library", | |
"var/mobile/Library/Preferences", | |
"var/mobile/Media", | |
"var/msgs", | |
"var/preferences", | |
"var/root", | |
"var/run", | |
"var/tmp", | |
// These are empty dirs | |
"var/empty", | |
"var/vm", | |
"System/Library/VideoDecoders", | |
"Library/LaunchAgents", | |
// And symlinks | |
"Library/Preferences", | |
"etc", | |
"tmp", | |
"var", | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment