mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
macOS: Do case-insensitive compare in auto-launch code
Case-sensitive compares will give problems when a launchd plist file exists, but the executable gets upated, and the name only has a different case (e.g.: owncloud -> ownCloud). Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
parent
76cf707934
commit
1f046ccd5e
@ -108,7 +108,8 @@ bool Utility::hasLaunchOnStartup(const QString &appName)
|
||||
// ... and yes, it's the correct app-id...
|
||||
if (id program = plist[@"Program"]) {
|
||||
// .. and there is a program mentioned ...
|
||||
if ([QCoreApplication::applicationFilePath().toNSString() isEqualToString:program]) {
|
||||
// (Note: case insensitive compare, because most fs setups on mac are case insensitive)
|
||||
if ([QCoreApplication::applicationFilePath().toNSString() compare:program options:NSCaseInsensitiveSearch] == NSOrderedSame) {
|
||||
// ... and it's our executable ..
|
||||
if (NSNumber *value = plist[@"RunAtLoad"]) {
|
||||
// yes, there is even a RunAtLoad key, so use it!
|
||||
@ -194,7 +195,7 @@ void Utility::setLaunchOnStartup(const QString &appName, const QString &guiName,
|
||||
if (!result) {
|
||||
qCWarning(lcUtility) << result.error();
|
||||
}
|
||||
} else if ([fullPath isEqualToString:programValue]) {
|
||||
} else if ([fullPath compare:programValue options:NSCaseInsensitiveSearch] == NSOrderedSame) { // (Note: case insensitive compare, because most fs setups on mac are case insensitive)
|
||||
// Wohoo, it's ours! Now carefully change only the RunAtLoad entry. If any value for
|
||||
// e.g. KeepAlive was changed, we leave it as-is.
|
||||
auto result = modifyPlist(plistFile, plist, enable);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user