Skip to content

Commit

Permalink
use unlink if file
Browse files Browse the repository at this point in the history
  • Loading branch information
quintenroets committed Mar 5, 2024
1 parent af9c4d4 commit eef18b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.0.1
current_version = 2.0.2
commit = False
allow_dirty = True

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "superpathlib"
version = "2.0.1"
version = "2.0.2"
description = "Extended Pathlib"
authors = [{name = "Quinten Roets", email = "qdr2104@columbia.edu"}]
license = {text = "MIT"}
Expand Down
5 changes: 4 additions & 1 deletion src/superpathlib/extra_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def cast_path(casted_path: PathType | None) -> PathType:
extract_dir = cast_path(extract_dir)

if remove_existing:
extract_dir.rmtree(missing_ok=True)
if extract_dir.is_dir():
extract_dir.rmtree(missing_ok=True)
else:
extract_dir.unlink(missing_ok=True)

shutil.unpack_archive(self, extract_dir=extract_dir, format=archive_format)

Expand Down

0 comments on commit eef18b6

Please sign in to comment.