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:
parent
bab752bf09
commit
0c50e8b94c
13
uninstall.py
13
uninstall.py
@ -10,6 +10,16 @@ import shutil
|
|||||||
import sys
|
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():
|
def parse_arguments():
|
||||||
parser = ArgumentParser(
|
parser = ArgumentParser(
|
||||||
description='Uninstalls autojump.')
|
description='Uninstalls autojump.')
|
||||||
@ -57,6 +67,9 @@ def remove_custom_installation(args, dryrun=False):
|
|||||||
rmdir(icon_dir, dryrun)
|
rmdir(icon_dir, dryrun)
|
||||||
rm(os.path.join(doc_dir, 'autojump.1'), 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):
|
def remove_system_installation(dryrun=False):
|
||||||
default_destdir = '/'
|
default_destdir = '/'
|
||||||
|
Loading…
Reference in New Issue
Block a user