diff --git a/menuinst/platforms/win.py b/menuinst/platforms/win.py index 84412a39..97ea56d7 100644 --- a/menuinst/platforms/win.py +++ b/menuinst/platforms/win.py @@ -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)