Skip to content

Commit

Permalink
Check if dir exists before deleting; 0.4.2 (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
hfaran authored Mar 21, 2018
1 parent 80138f3 commit 045a687
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ install:
- "pip install -r dev-requirements.txt"
script:
- python app.py -z tests/testarchive.zip --test
- python cli.py clean
- python cli.py clean -w
2 changes: 1 addition & 1 deletion slackviewer/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.1"
__version__ = "0.4.2"
9 changes: 7 additions & 2 deletions slackviewer/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import click
import shutil

import os

from slackviewer.constants import SLACKVIEWER_TEMP_PATH
from slackviewer.utils.click import envvar, flag_ennvar

Expand All @@ -16,7 +18,10 @@ def cli():
help="Actually performs file deletion")
def clean(wet):
if wet:
print("Removing {}...".format(SLACKVIEWER_TEMP_PATH))
shutil.rmtree(SLACKVIEWER_TEMP_PATH)
if os.path.exists(SLACKVIEWER_TEMP_PATH):
print("Removing {}...".format(SLACKVIEWER_TEMP_PATH))
shutil.rmtree(SLACKVIEWER_TEMP_PATH)
else:
print("Nothing to remove! {} does not exist.".format(SLACKVIEWER_TEMP_PATH))
else:
print("Run with -w to remove {}".format(SLACKVIEWER_TEMP_PATH))

0 comments on commit 045a687

Please sign in to comment.