Skip to content

Commit

Permalink
Check if menu location exists before iterating
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoesters committed May 28, 2024
1 parent fa5e5a2 commit bf42914
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion menuinst/platforms/win.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def create(self) -> Tuple[os.PathLike]:
def remove(self) -> Tuple[os.PathLike]:
# Only remove if the Start Menu directory is empty in case applications share a folder.
try:
next(Path(self.start_menu_location).iterdir())
menu_location = Path(self.start_menu_location)
if menu_location.exists():
next(menu_location.iterdir())
except StopIteration:
log.debug("Removing %s", self.start_menu_location)
shutil.rmtree(self.start_menu_location, ignore_errors=True)
Expand Down

0 comments on commit bf42914

Please sign in to comment.