Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Verbruggen <erik@verbruggen.consulting>2022-02-10 18:13:34 +0300
committerHannah von Reth <vonreth@kde.org>2022-02-11 17:47:27 +0300
commit9e7bd9be8312672c72251027db4e63df6fe6f550 (patch)
tree0d1dcb9f1355d60e37bdbaf677fcd3397f3f9399 /src/common
parent36a07868eab50c67a4e64a054736b32222fbe278 (diff)
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. https://github.com/owncloud/client/issues/9387
Diffstat (limited to 'src/common')
-rw-r--r--src/common/utility_mac.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/common/utility_mac.cpp b/src/common/utility_mac.cpp
index 662a21311..52c7afea2 100644
--- a/src/common/utility_mac.cpp
+++ b/src/common/utility_mac.cpp
@@ -62,7 +62,13 @@ bool hasLaunchOnStartup_private(const QString &)
if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, NULL) == noErr && itemUrlRef) {
CFStringRef itemUrlString = CFURLGetString(itemUrlRef);
- if (CFStringCompare(itemUrlString, appUrlRefString, 0) == kCFCompareEqualTo) {
+
+ // Check if we found "our" app url.
+ // IMPORTANT: this needs to be a case-insensitive compare, because (most) macOS
+ // file systems are case insensitive, so if e.g. "btr.app" is replaced by "BtR.app"
+ // in an update, they should be treated the same.
+ // See also: https://github.com/owncloud/client/issues/9387
+ if (CFStringCompare(itemUrlString, appUrlRefString, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
returnValue = true;
}
CFRelease(itemUrlRef);
@@ -108,7 +114,13 @@ void setLaunchOnStartup_private(const QString &appName, const QString &guiName,
if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, NULL) == noErr && itemUrlRef) {
CFStringRef itemUrlString = CFURLGetString(itemUrlRef);
- if (CFStringCompare(itemUrlString, appUrlRefString, 0) == kCFCompareEqualTo) {
+
+ // Check if we found "our" app url.
+ // IMPORTANT: this needs to be a case-insensitive compare, because (most) macOS
+ // file systems are case insensitive, so if e.g. "btr.app" is replaced by "BtR.app"
+ // in an update, they should be treated the same.
+ // See also: https://github.com/owncloud/client/issues/9387
+ if (CFStringCompare(itemUrlString, appUrlRefString, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
LSSharedFileListItemRemove(loginItems, item); // remove it!
}
CFRelease(itemUrlRef);