Skip to content

Commit 1bd419b

Browse files
committed
macOS: Fix path comparison in launch-on-startup code
When checking if the client is auto-started, the list of all login-items is retrieved, and each item is compared to the path of the .app bundle. This comparison needs to be done ignoring the case, as most macOS file systems are case-insensitive. #9387
1 parent 68eacec commit 1bd419b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

changelog/unreleased/9387

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Bugfix: Fix toggling launch-on-login for macOS
2+
3+
This would fail when upgrading the application, and the upgraded version
4+
has one or more letters in the name changed from/to upper-case.
5+
6+
https://github.com/owncloud/client/issues/9387
7+
https://github.com/owncloud/client/pull/9433

src/common/utility_mac.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ bool hasLaunchOnStartup_private(const QString &)
6262

6363
if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, NULL) == noErr && itemUrlRef) {
6464
CFStringRef itemUrlString = CFURLGetString(itemUrlRef);
65-
if (CFStringCompare(itemUrlString, appUrlRefString, 0) == kCFCompareEqualTo) {
65+
if (CFStringCompare(itemUrlString, appUrlRefString, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
6666
returnValue = true;
6767
}
6868
CFRelease(itemUrlRef);
@@ -108,7 +108,7 @@ void setLaunchOnStartup_private(const QString &appName, const QString &guiName,
108108

109109
if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, NULL) == noErr && itemUrlRef) {
110110
CFStringRef itemUrlString = CFURLGetString(itemUrlRef);
111-
if (CFStringCompare(itemUrlString, appUrlRefString, 0) == kCFCompareEqualTo) {
111+
if (CFStringCompare(itemUrlString, appUrlRefString, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
112112
LSSharedFileListItemRemove(loginItems, item); // remove it!
113113
}
114114
CFRelease(itemUrlRef);

0 commit comments

Comments
 (0)