1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

remove empty custom installation directories

This commit is contained in:
William Ting 2013-12-30 15:38:19 -06:00
parent bab752bf09
commit 0c50e8b94c

View File

@ -10,6 +10,16 @@ import shutil
import sys
def is_empty_dir(path):
"""
Checks if any files are present within a directory and all sub-directories.
"""
for _, _, files in os.walk(path):
if files:
return False
return True
def parse_arguments():
parser = ArgumentParser(
description='Uninstalls autojump.')
@ -57,6 +67,9 @@ def remove_custom_installation(args, dryrun=False):
rmdir(icon_dir, dryrun)
rm(os.path.join(doc_dir, 'autojump.1'), dryrun)
if is_empty_dir(args.destdir):
rmdir(args.destdir, dryrun)
def remove_system_installation(dryrun=False):
default_destdir = '/'