Adhere to XDG specification for cache dir.

This commit is contained in:
Anthony Sottile 2017-09-04 13:39:12 -07:00
parent ef8347cf2d
commit 0120af56a7
9 changed files with 50 additions and 17 deletions

View file

@ -8,7 +8,9 @@ from pre_commit.util import rmtree
def clean(runner):
if os.path.exists(runner.store.directory):
rmtree(runner.store.directory)
output.write_line('Cleaned {}.'.format(runner.store.directory))
legacy_path = os.path.expanduser('~/.pre-commit')
for directory in (runner.store.directory, legacy_path):
if os.path.exists(directory):
rmtree(directory)
output.write_line('Cleaned {}.'.format(directory))
return 0