Skip to content

Commit

Permalink
fix set launch at login crash in macOS 10.12
Browse files Browse the repository at this point in the history
  • Loading branch information
yichengchen committed Dec 8, 2020
1 parent 4119521 commit 54f5df6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ClashX/Vendor/LoginServiceKit/LoginServiceKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ public extension LoginServiceKit {
guard let sharedFileList = LSSharedFileListCreate(nil, kLSSharedFileListSessionLoginItems.takeRetainedValue(), nil) else { return false }
let loginItemList = sharedFileList.takeRetainedValue()
let url = URL(fileURLWithPath: path)
LSSharedFileListInsertItemURL(loginItemList, nil, nil, nil, url as CFURL, nil, nil)
if #available(macOS 11, *) {
LSSharedFileListInsertItemURL(loginItemList, nil, nil, nil, url as CFURL, nil, nil)
} else {
LSSharedFileListInsertItemURL(loginItemList, kLSSharedFileListItemBeforeFirst.takeRetainedValue(), nil, nil, url as CFURL, nil, nil)
}
return true
}

Expand Down

0 comments on commit 54f5df6

Please sign in to comment.