AddonManager: handle the case of symlinked addon when uninstalling

see #11045
This commit is contained in:
Adrian Insaurralde Avalos
2023-10-16 20:16:39 -03:00
committed by Chris Hennes
parent 6c1c25b24a
commit dcddc3dc64

View File

@@ -97,7 +97,10 @@ def symlink(source, link_name):
def rmdir(path: os.PathLike) -> bool:
try:
shutil.rmtree(path, onerror=remove_readonly)
if os.path.islink(path):
os.unlink(path) # Remove symlink
else:
shutil.rmtree(path, onerror=remove_readonly)
except (WindowsError, PermissionError, OSError):
return False
return True