Merge pull request #602 from pre-commit/xdg_cache_dir

Adhere to XDG specification for cache dir.
This commit is contained in:
Anthony Sottile 2017-09-07 08:19:45 -07:00 committed by GitHub
commit 9ff6818270
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