Skip to content

Commit 65567c0

Browse files
committed
Replace LSSharedFileListItemCopyResolvedURL with LSSharedFileListItemResolve. Both are deprecated but prior appears to no longer be supported
1 parent dac1dcf commit 65567c0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

FinderSidebarEditor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from Foundation import NSBundle
88
from LaunchServices import kLSSharedFileListFavoriteItems
99
from objc import loadBundleFunctions, initFrameworkWrapper, pathForFramework
10+
from CoreServices import LSSharedFileListCreate, kLSSharedFileListFavoriteItems, LSSharedFileListInsertItemURL
1011

1112
os_version = int(mac_ver()[0].split('.')[1])
1213
if os_version > 10:
@@ -186,11 +187,12 @@ def remove_by_path(self, path):
186187
"""
187188
comparison_path = f'file://{path}/'.upper()
188189
for item in self.snapshot[0]:
189-
sidebar_item = LSSharedFileListItemCopyResolvedURL(item, 0, None)
190-
if comparison_path == str(sidebar_item[0]).upper():
190+
sidebar_item = LSSharedFileListItemResolve(item, 0, None, None)
191+
if comparison_path == str(sidebar_item[1]).upper():
191192
LSSharedFileListItemRemove(self.sflRef, item)
192193
self.synchronize()
193194
self.update()
195+
194196

195197
def add(self, to_add, uri="file://localhost"):
196198
"""

0 commit comments

Comments
 (0)