Skip to content

Commit 2c10573

Browse files
authored
Merge pull request #1676 from stonebig/master
fix #1675
2 parents 60730d5 + 0e2d399 commit 2c10573

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

wppm/associate.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import winreg
1313
from . import utils
1414
from argparse import ArgumentParser
15+
import shutil
1516

1617
def get_special_folder_path(path_name):
1718
"""Return special folder path."""
@@ -37,7 +38,7 @@ def remove_winpython_start_menu_folder(current=True):
3738
path = get_winpython_start_menu_folder(current=current)
3839
if Path(path).is_dir():
3940
try:
40-
shutil.rmtree(path, onexc=onerror)
41+
shutil.rmtree(path)
4142
except WindowsError:
4243
print(f"Directory {path} could not be removed", file=sys.stderr)
4344

@@ -46,7 +47,7 @@ def create_winpython_start_menu_folder(current=True):
4647
path = get_winpython_start_menu_folder(current=current)
4748
if Path(path).is_dir():
4849
try:
49-
shutil.rmtree(path, onexc=onerror)
50+
shutil.rmtree(path)
5051
except WindowsError:
5152
print(f"Directory {path} could not be removed", file=sys.stderr)
5253
Path(path).mkdir(parents=True, exist_ok=True)
@@ -239,7 +240,7 @@ def register(target, current=True, reg_type=winreg.REG_SZ, verbose=True):
239240
# Create start menu entries
240241
if has_pywin32:
241242
if verbose:
242-
print(f'Creating WinPython menu for all icons in {target.parent}')
243+
print(f'Creating WinPython menu for all icons in {Path(target).parent}')
243244
for path, desc, fname in _get_shortcut_data(target, current=current, has_pywin32=True):
244245
try:
245246
create_shortcut(path, desc, fname, verbose=verbose)
@@ -268,7 +269,7 @@ def unregister(target, current=True, verbose=True):
268269
# Remove start menu shortcuts
269270
if has_pywin32:
270271
if verbose:
271-
print(f'Removing WinPython menu for all icons in {target.parent}')
272+
print(f'Removing WinPython menu for all icons in {Path(target).parent}')
272273
_remove_start_menu_folder(target, current=current, has_pywin32=True)
273274
# The original code had commented out code to delete .lnk files individually.
274275
else:

0 commit comments

Comments
 (0)